I am trying to make a simple app which does the following. There is an ImageView and a SurfaceView for mediaPlay.
- If this view is not touched, do nothing.
- If this view is being touched, leave a log message every 100 ms.
Assumption - we have printLogMsg() already available for 2.
So what I am gonna do is to set a onTouchListener to the imageView. My question is, how can I perform printLogMsg() within this onTouchListener.
private OnTouchListener mTouchListener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
Log.d("log", "!!!down");
break;
case MotionEvent.ACTION_HOVER_ENTER:
Log.d("log", "!!!hover enter");
break;
case MotionEvent.ACTION_UP:
Log.d("log", "!!!up");
break;
}
return false;
}
};
I have something like this but touching the ImageView will print "down" just once. Is there a way to do this? Thanks!
Thanks :)