My game uses openGL ES 2.0 on Android and it's got to the point where the pause (while loading resources) has become noticeable.
All I'm after is to show a static screen (probably via an XML layout if it's the simplest way, but through openGL is OK too). And then dismiss the view and switch to the game.
I'm loading my resources in the onSurfaceCreated method of my GLSurfaceView class and creating my sprite objects in my onSurfaceChanged method (I need the width and height to scale them, so do it here, plus Google's docs recommend it). I don't load my resources in onCreate.
I've tried creating a simple XML layout called 'loading' and putting something like this into my glSurfaceView class's constructor (glSurfaceView being an inner class of my Activity class)....
public MyGLSurfaceView(Context context) {
super(context);
{
loading_dialog = new Dialog(context,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
loading_dialog.setContentView(R.layout.loading);
loading_dialog.show();
}
This displays my 'loading' screen OK, but I need to call:
loading_dialog.dismiss();
at the end of my onSurfaceChanged method in my GLSurfaceView.Renderer class. I obviously can't do this as the GLSurfaceView.Renderer class has no knowledge of the loading_dialog object.
I tried to create the object directly in the GLSurfaceView.Renderer class, but I don't have access to the context from here, so I tried to pass it in from the Activity class but then I got different errors at which point, I searched the net and couldn't find a clear answer on how to do this so thought I would post here in the hope that someone could point me in the right direction.