import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
-import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
private Method mOnNewIntent;
private Method mEnableRemoteDebugging;
private Method mDisableRemoteDebugging;
- private Method mOnKeyUp;
// For instrumentation test.
private Method mGetTitleForTest;
mOnNewIntent = lookupMethod("onNewIntent", Intent.class);
mEnableRemoteDebugging = lookupMethod("enableRemoteDebugging", String.class, String.class);
mDisableRemoteDebugging = lookupMethod("disableRemoteDebugging");
- mOnKeyUp = lookupMethod("onKeyUp", int.class, KeyEvent.class);
}
/**
invokeMethod(mDisableRemoteDebugging, mInstance);
}
- /**
- * Passdown key-up event to the runtime view.
- * Usually meet the case of clicking on the back key.
- */
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- // Normally, java can handle the convertion of boolean and Boolean well,
- // But here invokeMethod is possible to return null if runtime lib not found,
- // Convert null to boolean will cause NullPointerException.
- Boolean handled = (Boolean) invokeMethod(mOnKeyUp, mInstance, keyCode, event);
- if (handled != null) return handled;
- return false;
- }
-
// The following functions just for instrumentation test.
public View getViewForTest() {
return (View)mInstance;