Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 769894 - Part 1: Create PromptService's AlertDialog on the UI thr…

…ead. r=mfinkle a=akeybl
  • Loading branch information...
commit 8274747021e826c1e8e4ad04fa34607ed79d657d 1 parent 9179dbd
Chris Peterson cpeterso authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 mobile/android/base/PromptService.java
13 mobile/android/base/PromptService.java
View
@@ -201,7 +201,7 @@ public String getResponse() {
}
public void show(String aTitle, String aText, PromptButton[] aButtons, PromptListItem[] aMenuList, boolean aMultipleSelection) {
- AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
if (!aTitle.equals("")) {
builder.setTitle(aTitle);
}
@@ -267,9 +267,14 @@ public void show(String aTitle, String aText, PromptButton[] aButtons, PromptLis
builder.setNegativeButton(aButtons[2].label, this);
}
- mDialog = builder.create();
- mDialog.setOnCancelListener(this);
- mDialog.show();
+ // The AlertDialog must be created on the UI thread, not the GeckoBackgroundThread.
+ GeckoAppShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ mDialog = builder.create();
+ mDialog.setOnCancelListener(PromptService.this);
+ mDialog.show();
+ }
+ });
}
public void onClick(DialogInterface aDialog, int aWhich) {
Please sign in to comment.
Something went wrong with that request. Please try again.