mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Fix NullPointerException in DroidGap.onMeasure()
It looks like on some devices the onMeasure() method is called before the callbackServer is instantiated. This causes a NullPointerException which kills the application.
This commit is contained in:
parent
1511183dfd
commit
fae551f0ce
@ -1695,15 +1695,19 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// If the height as gotten bigger then we will assume the soft keyboard has
|
// If the height as gotten bigger then we will assume the soft keyboard has
|
||||||
// gone away.
|
// gone away.
|
||||||
else if (height > oldHeight) {
|
else if (height > oldHeight) {
|
||||||
|
if (callbackServer != null) {
|
||||||
LOG.v(TAG, "Throw hide keyboard event");
|
LOG.v(TAG, "Throw hide keyboard event");
|
||||||
callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('hidekeyboard');");
|
callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('hidekeyboard');");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If the height as gotten smaller then we will assume the soft keyboard has
|
// If the height as gotten smaller then we will assume the soft keyboard has
|
||||||
// been displayed.
|
// been displayed.
|
||||||
else if (height < oldHeight) {
|
else if (height < oldHeight) {
|
||||||
|
if (callbackServer != null) {
|
||||||
LOG.v(TAG, "Throw show keyboard event");
|
LOG.v(TAG, "Throw show keyboard event");
|
||||||
callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('showkeyboard');");
|
callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('showkeyboard');");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the old height for the next event
|
// Update the old height for the next event
|
||||||
oldHeight = height;
|
oldHeight = height;
|
||||||
|
Loading…
Reference in New Issue
Block a user