I want my application to display a ZoomButtonsController on a GLSurfaceView whenever the user touches the GLSurfaceView. My activity constructor looks like this:
_zoomButtonsController = new ZoomButtonsController(_surface);
_zoomButtonsController.setAutoDismissed(true);
_zoomButtonsController.setOnZoomListener(_zoomListener); // Set listener
Then I override onTouchEvent() to make the ZoomButtonsController visible when the user generates an ACTION_MOVE event:
/** Called when user generates touch event */
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
// Does this somehow register an IntentListener???
if (_zoomButtonsController != null) {
_zoomButtonsController.setVisible(true);
}
The application appears to work until I exit, at which time I get:
D/Solaris (22616): onDestroy() E/WindowManager(22616): Activity com.tomoreilly.solarisalpha.SolarisAlpha has leaked window android.widget.ZoomButtonsController$Container@4495c640 that was originally added here
and the stack trace refers to the line in onTouchEvent where _zoomButtonsController.setVisible(true) was called.
Why is this? Why does setting the zoom button controller visible also register it as an intent listener? And how the heck do I unregister it? Am I actually using the proper approach - i.e. should I call ZoomButtonsController.setVisible(true) from within Activity.onTouchEvent()?
Thanks, Tom