Is there a way where I can add a listener to a layout or view and as a user touches the screen it will add the count. Something like
tvTouchCount.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int count = 0;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
count = count + 1;
if (count > maxCount)
maxCount = count;
tvTouchCount.setText("Max Count=" + maxCount);
return false;
case MotionEvent.ACTION_UP:
count = count - 1;
return false;
default:
return false;
}
}
});
I've tried getting the details from the package manager but that only tells me if it supports 2 , 2-5, and 5+ independent touchs and not the exact number