I’ve got a component that I want to make various changes to content and display when touched, and revert when the finger goes back up. The following works in general, but if the user’s finger wanders out off the component itself before lifting, ACTION_UP never fires, so it never reverts to the “up” state.
public class MyComponent extends SomeLayout {
// ... stuff
@Override
public boolean onTouchEvent(MotionEvent event) {
final int action = event.getAction() & MotionEvent.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN :
// do something...
break;
case MotionEvent.ACTION_UP :
// do something else...
break;
}
return super.onTouchEvent(event);
}
}
This ViewGroup has complex content, and is not something that’d be appropriate for StateDrawables.
Any suggestions?
TYIA
for future searchers, the answer is ACTION_CANCEL…