snairsumith / beginning-android-games

Automatically exported from code.google.com/p/beginning-android-games
0 stars 0 forks source link

Using AlertDialog inside one of these games #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sorry for posting this here but I assumed that someone using the framework 
might be able to help.

Does anyone know how I can show an AlertDialog within a game screen using the 
Canvas version of the framework? I've tried adding a showMessage() method to 
various parts of the code but always get the old error:

Can't create handler inside thread that has not called Looper.prepare()

because the call is always being made on the renderThread rather than the UI 
thread. Can anyone help with a good way to do this?

Original issue reported on code.google.com by crund...@gmail.com on 7 Jun 2011 at 11:14

GoogleCodeExporter commented 8 years ago
NVM, got it in the end. I had to create a custom message object which 
implements Runnable and then send that to a function in AndroidGame which calls 
runOnUiThread on it.

Original comment by crund...@gmail.com on 9 Jun 2011 at 10:04

GoogleCodeExporter commented 8 years ago

Original comment by badlogicgames on 24 Aug 2011 at 4:07

GoogleCodeExporter commented 8 years ago
And How did you do it? I have the same problem :/

Original comment by carlosma...@gmail.com on 16 Nov 2012 at 1:56