Boy
Boy

Reputation: 7487

AlertDialog.Builder create does not return

Because of my frustration that there was no clear error message (no exception or whatever), I want to prevent people having the same problem.

Here's the problem:

AlertDialog.Builder builder = new AlertDialog.Builder(MyActivity);
...
AlertDialog dialog = builder.create(); // <-- does not return!
dialog.show();  // <-- never gets hit

Upvotes: 0

Views: 368

Answers (1)

Boy
Boy

Reputation: 7487

The reason why it never returns, is because it is not being run from the UI thread.

Check if you are running this on the UI thread adding this:

boolean uithread = Looper.myLooper() == Looper.getMainLooper();

Upvotes: 2

Related Questions