Fireing Android Dialogs from another thread without Message Loop

Posted by Jox on Stack Overflow See other posts from Stack Overflow or by Jox
Published on 2010-01-11T14:57:35Z Indexed on 2010/04/18 0:13 UTC
Read the original article Hit count: 510

In a SurfaceView, I'm dispatching new thread that draws on canvas within standard "LockCanvas-Draw-unlockCanvasAndPost" loop. (note that thread doesn't contains message loop).

How to show Android standard Dialog from that thread?

As thread doesn't have msg loop, following code doesn't work:

Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Alert");
builder.setMessage("Stackoverflow!");
builder.setNegativeButton("cancel", null);
builder.show(); 

© Stack Overflow or respective owner

Related posts about android

Related posts about surfaceview