android - How to Stop OnTouchListener while user is touching the screen? -


I am looking for a way to force the user to increase my finger before the next action. I have a situation when the user chooses something on the scene and I do not want to open it again again and again without lifting your finger.

This is my basic question:

Enter image details here

option 1:

Set OnClickListener instead of OnTouchListener.

Option 2:

Hold ACTION_UP and then apply your action only.

Boolean Press Flag = Wrong; Public Boolean On-Touch (see V, Motion Event Event) {int action = event.getAction (); Switch (Action) {Case MotionEvent.ACTION_DOWN: if (pressFlag == incorrect) {// Press Your Action Flag == True; } Else {// nothing} break; Case Motion Event Action_UP: Press Flag == Wrong; break; Default: Break; } Back true;

}


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Create dynamic LINQ query expression at runtime which translates into a parameterized SQL query for nullable types -

cmake - cpack generates RPMs with %files entries that conflict with the RPM spec. How to fix? -