My GestureListener class receives a MotionEvent in methods like onSingleTap() or onFling(). Is there a way to determine the underlying view from this event?
Background: I have a LinearLayout which contains many child views. This LinearLayout has a touch listener on it, which calls to a gesture detector. So when the user does a gesture on any child view, the LinearLayout's gesture detector receives a MotionEvent. But the problem is, because there are many children, I need to know exactly which child the user tapped on. But I can't find a method that converts a coordinate to a view. Is there a way to do this?
An ugly solution: The children are added dynamically. So I can keep all the children in a list, then when a MotionEvent comes, I can iterate through the list and see if the point is inside a child. But I don't like this idea. Is there a better way?