Skip to content

Instantly share code, notes, and snippets.

@g0ody
Last active December 15, 2015 17:49
Show Gist options
  • Save g0ody/5299480 to your computer and use it in GitHub Desktop.
Save g0ody/5299480 to your computer and use it in GitHub Desktop.
Numeric 9 Key not working in Cordova 2.5. Copy this in your Android Project Main File. in platforms/android/src/com/sample/project/app.java
// ADD IMPORTS:
// import android.webkit.WebSettings;
// import java.lang.reflect.Method;
// import java.lang.reflect.InvocationTargetException;
@Override
public void init() {
super.init();
try {
Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
gingerbread_getMethod.invoke(this.appView.getSettings(), false);
}
} catch (NoSuchMethodException e) {
Log.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
} catch (IllegalArgumentException e) {
Log.d(TAG, "Doing the NavDump failed with bad arguments");
} catch (IllegalAccessException e) {
Log.d(TAG, "This should never happen: IllegalAccessException means this isn't Android anymore");
} catch (InvocationTargetException e) {
Log.d(TAG, "This should never happen: InvocationTargetException means this isn't Android anymore.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment