Skip to content Skip to sidebar Skip to footer

Why Would Ontouch() Generate Fatal Exception When Returning False?

I wrote a simple MotionEvent exercise in which all I do is log the parameters of the event. I do that by implementing OnTouchListener and overriding onTouch() in the main activity.

Solution 1:

Are you recycling and then passing false?

The framework will assume that the MotionEvent is still valid if you return false and will do its own processing with it.

From the docs:

Recycle the MotionEvent, to be re-used by a later caller. After calling this function you must not ever touch the event again.

Post a Comment for "Why Would Ontouch() Generate Fatal Exception When Returning False?"