I avoided this problem, but did not solve it for my game:
I use "FrameLayout" as the main layout, and "GLSurfaceView" is the first layout inside it (that is, at the bottom of the stack), the following menu view group and the opaque loading screen (set match_parent to fill the screen):
<FrameLayout android:id="@+id/graphics_frameLayout1" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent"> <android.opengl.GLSurfaceView android:id="@+id/graphics_glsurfaceview1" android:layout_width="fill_parent" android:layout_height="fill_parent"> </android.opengl.GLSurfaceView> <LinearLayout android:id="@+id/menu_linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:visiblility="gone" android:background="#000000">// opaque background // menus etc be here </LinearLayout> <LinearLayout android:layout_height="fill_parent" android:id="@+id/loading_linearLayout1" android:layout_width="fill_parent" android:orientation="vertical" android:background="#000000">// opaque background <ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/loading_progressBar1"> </ProgressBar> <TextView android:layout_width="wrap_content" android:id="@+id/loading_textView1" android:layout_height="wrap_content" android:text="Loading..."> </TextView> </LinearLayout> </FrameLayout>
When the download is finished, I set the viewing group to view invisible or left, and the menu viewing group to visible. Once the user has chosen the option to start the game, I start the logical flow of the game and again force the menu
I have a hierarchy of actions ( ReTouchMenuActivity extends ReTouchActivity , and then in the new ReTouchActivity extends RokonActivity ), so I do not get the whole game in one unmanaged file
I load other assets into separate streams (e.g. vertex data for 3D models) and then load them into vertices, texture codes, etc. immediately before drawing arrays (i.e. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, meshVertices);
The real problem is that you need to load textures in the GL stream, which can block the user interface stream (albeit without failures), which does not lead to a response to user input when loading large textures. My own game using the ZTE Blade running Android 2.1 above can take up to two seconds to load some large textures (1mb +), and even the circular progress bar stops spinning during this time.
I noticed that you finish() activity when the user presses the "Exit" button, but when the user leaves the application without pressing the "exit" button (say, when they receive an incoming call or select something from the notification panel), the action / app is still running in the background. You must reload the textures when they return the action / application back to the top of the stack (i.e. the user will open it again). If you do not overload the textures in such a scenario, the user will simply get the load empty instead of textures
If you try to save the GL descriptor / object as a variable, which android goes to your Renderer class' onDraw , for use by the texture load stream, for example, it goes out of context after onDraw returns and texture loading does not work.
I assume that the android erases all graphic data / OpenGL state when the user leaves the application, in case other applications want to use it. Therefore, I assume that you cannot do exactly what you are trying to do (pre-load textures into android os or something else). Although, if someone knows better, I will be interested to hear.
Edit:
This question has good answers about speeding up actual texture load times.