Skip to content Skip to sidebar Skip to footer

How Detect User Touch Interaction In Android?

In my activity there are ActionBar,ListView,ContextMenu,Menu. I wanted to capture the user interaction with my activity(means when ever user touch in my activity i wanted to show a

Solution 1:

I think you can override dispatchTouchEvent() in your Activity to get the result you want

something like this:

@OverridepublicbooleandispatchTouchEvent(MotionEvent me){
  //do somethingreturnsuper.dispatchTouchEvent(me);
}

See the activity docs for more

Also I think it is worth noting that your users may find it quite annoying if you are displaying a toast any time they touch anything on the screen.

Post a Comment for "How Detect User Touch Interaction In Android?"