hey could anyone please tell me how to create a dialog from a background thread that is not a UI thread in Android??
something like this..

Thread t=new Thread(new Runnable() {
    @Override
    public void run() {
        Thread innerThread=new Thread(new Runnable() {
            @Override
            public void run() {
                /////***** i need to create a dialog here *****////
                /////***** but the dialog doesn't appear or it closes too soon
                /////      to be able to record a user input *****////
            }
        });
    }
});

Recommended Answers

All 3 Replies

Depends on where you are triggering this dialog Activity or Fragment, you would use AlertDialog DialogFragment. Examples can be found here

the thing is I want the dialog box to block the thread which created/showed it until I get a response from the dialog box..could you please give me a few hints on how to do that??

i'm trying to make the game thread pause till the dialog box is dismissed after the input is received..

Have look on this post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.