Skip to content Skip to sidebar Skip to footer

Detect Which View Was Tapped In The Onsingletapconfirmed Method

I have many views (FrameLayouts) on my screen - each has a SimpleOnGestureListener set as the onTouchListener. I'm correctly getting the onSingleTapConfirmed method being fired whe

Solution 1:

I have many views (FrameLayouts) on my screen - each has a SimpleOnGestureListener set as the onTouchListener.

Save a reference to the View in the OnTouchListener, then when a gesture callback fires you'll already know which View was touched:

publicbooleanonTouch(View v, MotionEvent event) {
    // Remember which View was touched
    mCurrent = v; 

    // Pass event to gesture listener, etc
}

Now use mCurrent in onSingleTapConfirmed() and any other method.

Post a Comment for "Detect Which View Was Tapped In The Onsingletapconfirmed Method"