I have a GLSurfaceView that is rendering an image as a texture. I have attached a GestureDetector to the GLSurfaceView. When the user taps the screen i want to display a linear layout on top of the GLSurfaceView.
Currently when the user taps the GLSurfaceView the linearlayout displays but then disappears on its own in about 2-3 seconds. Every now and then it will flash on the screen for a split second. All this without any interactions from the user.
Any insights to what is happening? Here is what i have tried and some useful info.
- My GLSurfaceView is set to Render_When_Dirty mode and i have ensured that after the user taps there are no calls to the onDrawFrame method. I know this by logging a statement in the method.
- I have also verified that the setVisibility(boolean) method of the linearlayout is not being maliciously called.
Here is some code of how the GLSurfaceView is being created.
glSurfaceView = new GLSurfaceView(context) {
public void surfaceDestroyed(SurfaceHolder holder) {
super.surfaceDestroyed(holder);
Logger.w("Surface Destroyed");
if (sprite != null) {
// readerBitmap =sprite.bitmap;
time = sprite.time;
}
//glSurfaceView.setBackgroundColor(color.black);
if (myHandler != null) {
myHandler.sendEmptyMessage(9);
}
}
};
gestureDetector = new GestureDetector(context, new MyGestureDetector());
glSurfaceView.setOnTouchListener(touchListener);
// set our renderer to be the main renderer with
sprite = new GlRenderer(context,Global.PICTURES.get(Global.currentPictureIndex),myHandler, tempTime);
glSurfaceView.setRenderer(sprite);
glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
TextView tv = (TextView)findViewById(R.id.customTextView1);
tv.setVisibility(View.GONE);
//add to the view
mainLayout.removeView(glSurfaceView);
mainLayout.addView(glSurfaceView, 0);
P.S. This is on Android 4.0