Android Question GesturesDetector 2.2 - Null Pointer Error

Starchild

Active Member
Licensed User
Longtime User
I have been playing with the Gestures Detector 2.2 additional library.
I am consistantly getting a Null Pointer Error in the following situation.

If I touch a displayed view on the screen and before I release my touch, if the screen changes and the view/activity is replaced by another activity then the null pointer error occurs when I release my touch as the original object is no longer on the screen.

This is a common problem as many apps (including my Notification viewer) pop-up and take over the screen, regardless, if I am half way through touching something.

Placing a try/catch in my code does not trap this error as it is generated inside the library.
I need to be able to trap the null pointer generated inside the library so I can code for this situation.

Any ideas.
 

Dave O

Well-Known Member
Licensed User
Longtime User
I use GD in some of my apps, and learned that it sometimes generates null pointer exceptions when using the rapid debugger.

They go away if I switch to the legacy debugger. Not sure why, but this might give you another option to try.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I use GD in some of my apps, and learned that it sometimes generates null pointer exceptions when using the rapid debugger.

They go away if I switch to the legacy debugger. Not sure why, but this might give you another option to try.
You have to remove the gesture listener with RemoveGestureListener before replacing/removing the view or you'll continue to trigger events for this removed view. Anyway, as long as the view is not destroyed by the GC or set to null, there's no reason to such an exception in Release mode (I never use the Debug mode).
 
Last edited:
Upvote 0
Top