I have two activities A and B. I would like to have one touch event MotionEvent.ACTION_DOWN caught in A, while still holding down, launch B, then having the release event MotionEvent.ACTION_UP be caught in B.
In A there is a View v that has an OnTouchListener with the following callback:
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
startActivity(new Intent(A.this, B.class));
break;
case MotionEvent.ACTION_UP:
// not called
break;
}
// false doesn't work either
return true;
}
In B there is an overlapping View v2 (over the original v) with the same kind of OnTouchListener but B's "onTouch" is not getting called when activity starts unless I move my finger (regenerating touch events).
Simply put, I am doing an application that would cause a new activity to appear when holding down on the screen and finish when I release the finger.
Is it not possible to have a MotionEvent.ACTION_DOWNed state transfer from one view to another? Or does the new activity B clear any current "on screen touch listeners" only available to A because it was initiated there?
Thanks for any explanation of how these MotionEvents get dispatched to activities and/or any solution/hack to my problem.