From 12816aa8f3aafe6f769ae153f434de90bf7cfffe Mon Sep 17 00:00:00 2001 From: Bryce Curtis Date: Tue, 25 Oct 2011 11:44:06 -0500 Subject: [PATCH] Run error dialog on UI thread. --- framework/src/com/phonegap/DroidGap.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java index 5817c25c..956b4d61 100755 --- a/framework/src/com/phonegap/DroidGap.java +++ b/framework/src/com/phonegap/DroidGap.java @@ -1531,7 +1531,7 @@ public class DroidGap extends PhonegapActivity { * @param description A String describing the error. * @param failingUrl The url that failed to load. */ - public void onReceivedError(int errorCode, String description, String failingUrl) { + public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final DroidGap me = this; // If errorUrl specified, then load it @@ -1548,8 +1548,12 @@ public class DroidGap extends PhonegapActivity { // If not, then display error dialog else { - me.appView.setVisibility(View.GONE); - me.displayError("Application Error", description + " ("+failingUrl+")", "OK", true); + me.runOnUiThread(new Runnable() { + public void run() { + me.appView.setVisibility(View.GONE); + me.displayError("Application Error", description + " ("+failingUrl+")", "OK", true); + } + }); } }