Skip to content Skip to sidebar Skip to footer

Cancelling Event Due To No Window Focus : MotionEvent

Here's the story: I am trying to build a guessing game in Android Studio. Where the user has to guess a number that resides between 0 and 1000. Every time the user makes a guess, t

Solution 1:

You can override:

onKeyUp(int keyCode, KeyEvent event)

Solution 2:

Please follow below steps and let me know if it works

  1. Override dispatchKeyEvent to check is Tab or Enter is pressed.
  2. If Tab or Enter is pressed and EditTextView has focus, submit the guess.

Let me know if you have any doubts or need a code snippet.


Post a Comment for "Cancelling Event Due To No Window Focus : MotionEvent"