I have a Activity class and a Renderer class (extends GLSurfaceView implements Renderer).
Inside the Renderer class, I have an “onTouchEvent” method to handle touch events like rotation.
Now, I want to display a Menu that pops up on touching some part of the screen. I found that I need to implement a Menu in the Activity class(as we get the MenuInflator object here). However, I want to implement the Menu inside the onTouchEvent in my Renderer class so that the Menu shows up when some part of the screen is touched.
How can I implement this?
I am using Android/java/opengl1.0 .
Perhaps, you can do what you want with a context menu, which integrates well.
You can either override
onCreateContextMenu()in the activity and disable long press for context menu etc. or implement this method with another name.Then, you have to call this method from inside your renderer, which has access to its enclosing activity. Maybe, you want to move some invariant params like
View vinto the method.Android – how to disable long press on Search button (Nexus One)
http://developer.android.com/guide/topics/ui/menus.html#context-menu