onTouchEvent in TabActivity don't react on anything
-
29-09-2019 - |
Question
I have TabActivity:
public class timetable extends TabActivity
{
...
@Override
public boolean onTouchEvent(MotionEvent event)
{
Toast.makeText(this, "!", Toast.LENGTH_SHORT).show();
return true;
}
...
}
but anything not happend when I move my finger on screen (push, fling, ..) Help me!
Solution
Instead of
Toast.makeText(this, "!", Toast.LENGTH_SHORT).show();
put in
android.util.Log("TabActivity", "motion event type="+(event.getAction() & MotionEvent. ACTION_MASK)
Then you should see various events for touch down (0), move (2) and touch up (1). Take a look at Android log to see events (filter on TabActivity).
Edited:
I was not paying attention. TabActivity contains child Views which consume touch events. You should place your code inside child Views.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow