android Programming Glossary: keyevent.action_down
Selecting text in a WebView? http://stackoverflow.com/questions/1111844/selecting-text-in-a-webview fallback KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch this..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 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..
Android - capture/suppress Home and EndCall buttons events? http://stackoverflow.com/questions/1998278/android-capture-suppress-home-and-endcall-buttons-events onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_BACK mBackPressed true..
Android EditText ImeOptions “Done” track finish typing http://stackoverflow.com/questions/2004344/android-edittext-imeoptions-done-track-finish-typing actionId EditorInfo.IME_ACTION_DONE event.getAction KeyEvent.ACTION_DOWN event.getKeyCode KeyEvent.KEYCODE_ENTER onSearchAction v return..
Android: Programmatically animate between images in Gallery widget http://stackoverflow.com/questions/2731564/android-programmatically-animate-between-images-in-gallery-widget to fake the key presses. Eg. dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_DPAD_LEFT However I can't get this working..
Android - Volume Buttons used in my application http://stackoverflow.com/questions/2874743/android-volume-buttons-used-in-my-application return true case KeyEvent.KEYCODE_VOLUME_DOWN if action KeyEvent.ACTION_DOWN TODO return true default return super.dispatchKeyEvent event..
Is it possible to create an Android Service that listens for hardware key presses? http://stackoverflow.com/questions/2986337/is-it-possible-to-create-an-android-service-that-listens-for-hardware-key-presse onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_A Stuff return true case..
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 startActivity dialIntent dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP..
Android - Key Dispatching Timed Out http://stackoverflow.com/questions/3467205/android-key-dispatching-timed-out e e.printStackTrace dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent..
Android long-touch event http://stackoverflow.com/questions/3553163/android-long-touch-event KeyEvent.ACTION_UP boolean isPressed event.getAction KeyEvent.ACTION_DOWN event.getAction KeyEvent.ACTION_MULTIPLE if isKeyOfInterest..
Why is onKey() called twice? http://stackoverflow.com/questions/3802887/why-is-onkey-called-twice KeyEvent event This is the filter if event.getAction KeyEvent.ACTION_DOWN return true switch keyCode case KeyEvent.KEYCODE_1 MakeToast..
Intercept back button from soft keyboard http://stackoverflow.com/questions/3940127/intercept-back-button-from-soft-keyboard getKeyDispatcherState if state null if event.getAction KeyEvent.ACTION_DOWN event.getRepeatCount 0 state.startTracking event this return..
Use “ENTER” key on softkeyboard instead of clicking button http://stackoverflow.com/questions/4451374/use-enter-key-on-softkeyboard-instead-of-clicking-button View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_DPAD_CENTER case KeyEvent.KEYCODE_ENTER..
How to Capture soft keyboard input in a View? http://stackoverflow.com/questions/5419766/how-to-capture-soft-keyboard-input-in-a-view event Log.d TAG onKeyListener if event.getAction KeyEvent.ACTION_DOWN Perform action on key press Log.d TAG ACTION_DOWN return..
Android: how to select texts from webview http://stackoverflow.com/questions/6058843/android-how-to-select-texts-from-webview fallback KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch this.. view try KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch..
Android WebView, how to code the back button? http://stackoverflow.com/questions/6077141/android-webview-how-to-code-the-back-button onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_BACK if mWebView.canGoBack..
Android - registering a headset button click with BroadcastReceiver http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver if event null return int action event.getAction if action KeyEvent.ACTION_DOWN do something Toast.makeText context BUTTON PRESSED Toast.LENGTH_SHORT..
Android: Unregister camera button http://stackoverflow.com/questions/986602/android-unregister-camera-button onKey View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_CAMERA videoPreview.onCapture.. onKey View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_CAMERA videoPreview.onCapture..
Selecting text in a WebView? http://stackoverflow.com/questions/1111844/selecting-text-in-a-webview null m.invoke this null catch Exception e e.printStackTrace fallback KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch this And then you have to use ClipboardManager to watch for new..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 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 break catch Exception e Log.d TEST THIS IS NOT GOOD ..
Android - capture/suppress Home and EndCall buttons events? http://stackoverflow.com/questions/1998278/android-capture-suppress-home-and-endcall-buttons-events problem boolean mBackPressed false @Override public boolean onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_BACK mBackPressed true break case KeyEvent.KEYCODE_MENU if mBackPressed unLock break..
Android EditText ImeOptions “Done” track finish typing http://stackoverflow.com/questions/2004344/android-edittext-imeoptions-done-track-finish-typing actionId KeyEvent event if actionId EditorInfo.IME_ACTION_SEARCH actionId EditorInfo.IME_ACTION_DONE event.getAction KeyEvent.ACTION_DOWN event.getKeyCode KeyEvent.KEYCODE_ENTER onSearchAction v return true return false Update The above code would some times..
Android: Programmatically animate between images in Gallery widget http://stackoverflow.com/questions/2731564/android-programmatically-animate-between-images-in-gallery-widget handle DPAD key presses so a work around I thought of was to fake the key presses. Eg. dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_DPAD_LEFT However I can't get this working for some reason. Anyone tried this I notice three of the widget's..
Android - Volume Buttons used in my application http://stackoverflow.com/questions/2874743/android-volume-buttons-used-in-my-application
Is it possible to create an Android Service that listens for hardware key presses? http://stackoverflow.com/questions/2986337/is-it-possible-to-create-an-android-service-that-listens-for-hardware-key-presse Intent intent Stuff return null @Override public boolean onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_A Stuff return true case KeyEvent.KEYCODE_B Stuff return true etc. return super.onKeyDown..
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 Intent dialIntent new Intent Intent.ACTION_DIAL Uri.parse tel startActivity dialIntent dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK CallBacks from running..
Android - Key Dispatching Timed Out http://stackoverflow.com/questions/3467205/android-key-dispatching-timed-out try serviceBinder.endCall lineId catch RemoteException e e.printStackTrace dispatchKeyEvent new KeyEvent KeyEvent.ACTION_DOWN KeyEvent.FLAG_SOFT_KEYBOARD dispatchKeyEvent new KeyEvent KeyEvent.ACTION_UP KeyEvent.KEYCODE_BACK If I comment the..
Android long-touch event http://stackoverflow.com/questions/3553163/android-long-touch-event 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 stopUpdating else if isKeyOfInterest isPressed..
Why is onKey() called twice? http://stackoverflow.com/questions/3802887/why-is-onkey-called-twice @Override public boolean onKey View v int keyCode KeyEvent event This is the filter if event.getAction KeyEvent.ACTION_DOWN return true switch keyCode case KeyEvent.KEYCODE_1 MakeToast 1 break case KeyEvent.KEYCODE_2 MakeToast 2 break ..
Intercept back button from soft keyboard http://stackoverflow.com/questions/3940127/intercept-back-button-from-soft-keyboard KeyEvent.KEYCODE_BACK KeyEvent.DispatcherState state getKeyDispatcherState if state null if event.getAction KeyEvent.ACTION_DOWN event.getRepeatCount 0 state.startTracking event this return true else if event.getAction KeyEvent.ACTION_UP event.isCanceled..
Use “ENTER” key on softkeyboard instead of clicking button http://stackoverflow.com/questions/4451374/use-enter-key-on-softkeyboard-instead-of-clicking-button new OnKeyListener public boolean onKey View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_DPAD_CENTER case KeyEvent.KEYCODE_ENTER addCourseFromTextBox return true default..
How to Capture soft keyboard input in a View? http://stackoverflow.com/questions/5419766/how-to-capture-soft-keyboard-input-in-a-view new OnKeyListener public boolean onKey View v int keyCode KeyEvent event Log.d TAG onKeyListener if event.getAction KeyEvent.ACTION_DOWN Perform action on key press Log.d TAG ACTION_DOWN return true return false @Override public boolean onTouchEvent..
Android: how to select texts from webview http://stackoverflow.com/questions/6058843/android-how-to-select-texts-from-webview BookView.mWebView false catch Exception e e.printStackTrace fallback KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch this Getting this error 05 26 16 41 01.121 WARN System.err 1096.. works fine... Function is private void emulateShiftHeld WebView view try KeyEvent shiftPressEvent new KeyEvent 0 0 KeyEvent.ACTION_DOWN KeyEvent.KEYCODE_SHIFT_LEFT 0 0 shiftPressEvent.dispatch view Toast.makeText this select_text_now Toast.LENGTH_SHORT..
Android WebView, how to code the back button? http://stackoverflow.com/questions/6077141/android-webview-how-to-code-the-back-button this in my activities with WebViews @Override public boolean onKeyDown int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_BACK if mWebView.canGoBack true mWebView.goBack else finish return true return..
Android - registering a headset button click with BroadcastReceiver http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT if event null return int action event.getAction if action KeyEvent.ACTION_DOWN do something Toast.makeText context BUTTON PRESSED Toast.LENGTH_SHORT .show abortBroadcast And my main activity is the..
Android: Unregister camera button http://stackoverflow.com/questions/986602/android-unregister-camera-button new OnKeyListener public boolean onKey View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_CAMERA videoPreview.onCapture settings onCaptureButton ... return false Pressing.. new OnKeyListener public boolean onKey View v int keyCode KeyEvent event if event.getAction KeyEvent.ACTION_DOWN switch keyCode case KeyEvent.KEYCODE_CAMERA videoPreview.onCapture settings onCaptureButton ... return true return..
|