I want to intercept the touch events on my parent view with onInterceptTouchEvent (MotionEvent ev).
From there I want to know which view was clicked in
A simple way for getting the touched view is to set an OnTouchListener to the individual views and store the view in a class variable of the activity. Returning false will make the input event available to the method onTouchEvent() of the activity, where you can easily handle all the touch events (also the ones of your parent view).
myView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
touchedView = myView;
return false;
}
});
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
if(touchedView!=null) {
doStuffWithMyView(touchedView);
....
....