lacas
lacas

Reputation: 14077

Opengl-es android best way to preload images

I have a game app, and i have many screens. The first screen will be the SCREEN.LOADING screen.

When the app starting, I want to show a picture "loading please wait" while the images, menus, etc loaded succesfull.

I tried asynctask to do this, but its not work in GLThread. What is the way to do this in opengl-es?

03-06 12:46:35.282: ERROR/AndroidRuntime(32736): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

Thanks, Leslie

Upvotes: 3

Views: 614

Answers (1)

Matthew
Matthew

Reputation: 44919

Have you made sure to create your AsyncTask in the UI thread?

While queueEvent provides an easy way for the UI thread to communicate with the rendering thread, there isn't an obvious solution for the other way given to you by the framework.

As per this advice, passing a Handler (created in the UI thread) to the GL thread would allow the GL thread to send messages to the Handler. These messages would then be handled on the UI thread.

Upvotes: 1

Related Questions