android Programming Glossary: keyevent.action_up
Simulating power button press to display switch off dialog box http://stackoverflow.com/questions/11338022/simulating-power-button-press-to-display-switch-off-dialog-box new KeyEvent eventTime 2000 eventTime 2000 KeyEvent.ACTION_UP KeyEvent.KEYCODE_POWER 0 0 0 0 0 Log.i LOG_TAG String.valueOf.. Log.d LOG_TAG keyUp keycode wm.injectKeyEvent new KeyEvent KeyEvent.ACTION_UP keycode true catch RemoteException e TODO Auto generated catch.. down.toString KeyEvent up new KeyEvent now 2000 now 2000 KeyEvent.ACTION_UP KeyEvent.KEYCODE_POWER 0 Log.d LOG_TAG up.toString IWindowManager.Stub.asInterface..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 try int action event.getAction switch action case KeyEvent.ACTION_UP Log.d TEST BUTTON UP break case KeyEvent.ACTION_DOWN case..
How to programatically answer/end a call in Android 4.1? http://stackoverflow.com/questions/15481524/how-to-programatically-answer-end-a-call-in-android-4-1 answer.putExtra Intent.EXTRA_KEY_EVENT new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_HEADSETHOOK context.sendOrderedBroadcast answer.. buttonUp.putExtra Intent.EXTRA_KEY_EVENT new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_HEADSETHOOK sendOrderedBroadcast buttonUp android.permission.CALL_PRIVILEGED..
Android - Volume Buttons used in my application http://stackoverflow.com/questions/2874743/android-volume-buttons-used-in-my-application switch keyCode case KeyEvent.KEYCODE_VOLUME_UP if action KeyEvent.ACTION_UP TODO return true case KeyEvent.KEYCODE_VOLUME_DOWN if action..
Android : CalledFromWrongThreadException;: Only the original thread that created a view hierarchy can touch its views http://stackoverflow.com/questions/3280141/android-calledfromwrongthreadexception-only-the-original-thread-that-created KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK CallBacks from running Service private..
Android - Key Dispatching Timed Out http://stackoverflow.com/questions/3467205/android-key-dispatching-timed-out dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK If I comment the following out the..
Android long-touch event http://stackoverflow.com/questions/3553163/android-long-touch-event KeyEvent.KEYCODE_ENTER boolean isReleased event.getAction KeyEvent.ACTION_UP boolean isPressed event.getAction KeyEvent.ACTION_DOWN event.getAction..
Intercept back button from soft keyboard http://stackoverflow.com/questions/3940127/intercept-back-button-from-soft-keyboard event this return true else if event.getAction KeyEvent.ACTION_UP event.isCanceled state.isTracking event mSearchActivity.onBackPressed..
Get back key event on EditText http://stackoverflow.com/questions/5113437/get-back-key-event-on-edittext event if keyCode KeyEvent.KEYCODE_BACK event.getAction KeyEvent.ACTION_UP do your stuff return false return super.dispatchKeyEvent event..
EditText with soft keyboard and “Back” button http://stackoverflow.com/questions/6570974/edittext-with-soft-keyboard-and-back-button event if keyCode KeyEvent.KEYCODE_BACK event.getAction KeyEvent.ACTION_UP Do your thing here return false return super.dispatchKeyEvent..
Simulating power button press to display switch off dialog box http://stackoverflow.com/questions/11338022/simulating-power-button-press-to-display-switch-off-dialog-box dispateched boolean dispateched2 launcherButtonWInst.dispatchKeyEvent new KeyEvent eventTime 2000 eventTime 2000 KeyEvent.ACTION_UP KeyEvent.KEYCODE_POWER 0 0 0 0 0 Log.i LOG_TAG String.valueOf dispateched2 Second apporach private void generateKeys.. new KeyEvent KeyEvent.ACTION_DOWN keycode true Log.d LOG_TAG keyUp keycode wm.injectKeyEvent new KeyEvent KeyEvent.ACTION_UP keycode true catch RemoteException e TODO Auto generated catch block Log.e ERROR e.toString e.printStackTrace Third.. KeyEvent.KEYCODE_POWER 0 Log.d LOG_TAG down.toString KeyEvent up new KeyEvent now 2000 now 2000 KeyEvent.ACTION_UP KeyEvent.KEYCODE_POWER 0 Log.d LOG_TAG up.toString IWindowManager.Stub.asInterface ServiceManager.getService window .injectKeyEvent..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 Intent.EXTRA_KEY_EVENT if event null return try int action event.getAction switch action case KeyEvent.ACTION_UP Log.d TEST BUTTON UP break case KeyEvent.ACTION_DOWN case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE Log.d TEST BUTTON DOWN..
How to programatically answer/end a call in Android 4.1? http://stackoverflow.com/questions/15481524/how-to-programatically-answer-end-a-call-in-android-4-1 Intent answer new Intent Intent.ACTION_MEDIA_BUTTON answer.putExtra Intent.EXTRA_KEY_EVENT new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_HEADSETHOOK context.sendOrderedBroadcast answer null Log.d TAG Answered incoming call from number return.. buttonDown Intent buttonUp new Intent Intent.ACTION_MEDIA_BUTTON buttonUp.putExtra Intent.EXTRA_KEY_EVENT new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_HEADSETHOOK sendOrderedBroadcast buttonUp android.permission.CALL_PRIVILEGED Intent headSetUnPluggedintent..
Android - Volume Buttons used in my application http://stackoverflow.com/questions/2874743/android-volume-buttons-used-in-my-application event int action event.getAction int keyCode event.getKeyCode switch keyCode case KeyEvent.KEYCODE_VOLUME_UP if action KeyEvent.ACTION_UP TODO return true case KeyEvent.KEYCODE_VOLUME_DOWN if action KeyEvent.ACTION_DOWN TODO return true default return super.dispatchKeyEvent..
Android : CalledFromWrongThreadException;: Only the original thread that created a view hierarchy can touch its views http://stackoverflow.com/questions/3280141/android-calledfromwrongthreadexception-only-the-original-thread-that-created dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK CallBacks from running Service private final ICallDialogActivity.Stub iCallDialogActivity new ICallDialogActivity.Stub..
Android - Key Dispatching Timed Out http://stackoverflow.com/questions/3467205/android-key-dispatching-timed-out dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK If I comment the following out the pressing of the button image doesn't cause the crash try serviceBinder.endCall..
Android long-touch event http://stackoverflow.com/questions/3553163/android-long-touch-event isKeyOfInterest keyCode KeyEvent.KEYCODE_DPAD_CENTER keyCode KeyEvent.KEYCODE_ENTER boolean isReleased event.getAction KeyEvent.ACTION_UP boolean isPressed event.getAction KeyEvent.ACTION_DOWN event.getAction KeyEvent.ACTION_MULTIPLE if isKeyOfInterest isReleased..
Intercept back button from soft keyboard http://stackoverflow.com/questions/3940127/intercept-back-button-from-soft-keyboard KeyEvent.ACTION_DOWN event.getRepeatCount 0 state.startTracking event this return true else if event.getAction KeyEvent.ACTION_UP event.isCanceled state.isTracking event mSearchActivity.onBackPressed return true return super.dispatchKeyEventPreIme..
Get back key event on EditText http://stackoverflow.com/questions/5113437/get-back-key-event-on-edittext
EditText with soft keyboard and “Back” button http://stackoverflow.com/questions/6570974/edittext-with-soft-keyboard-and-back-button this method public boolean onKeyPreIme int keyCode KeyEvent event if keyCode KeyEvent.KEYCODE_BACK event.getAction KeyEvent.ACTION_UP Do your thing here return false return super.dispatchKeyEvent event Taken from my other answer @ Android Error popup on..
|