I'd like to read when a player touches the screen, and when not.
@Override
public boolean onTouchEvent(MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP){ //ACTION UP
actionOnUP = true;
Log.v("MC", "Up");
}
if(event.getAction() == 0){ //ACTION DOWN
actionOnUP = false;
Log.v("MC", "Down");
}
Log.v("MC", event.getAction() + " ");
return super.onTouchEvent(event);
}
This code, yes, it works, but only when player touch the screen (ACTION_DOWN), but when he don't touching the screen (ACTION_UP), nothing happens :/
^ This is screen form LogCat. You can see: this is only ACTION_DOWN, but nothing about ACTION_UP. Class is extending View:
public class MainClass extends SurfaceView implements SurfaceHolder.Callback {
Can you help me?
EDIT: My game is based on this tutorial: http://www.droidnova.com/2d-tutorial-series-part-v,848.html