diff options
author | Angus Kong <shkong@google.com> | 2011-09-15 06:06:17 +0800 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2011-09-15 06:31:24 +0800 |
commit | 59a140990af1ba6d2c9aa627047a02e50c8dd0e1 (patch) | |
tree | 722598089c0dbbf671418ff856e6f4d92442853c /src | |
parent | cd34658b41261998dd8f2ba0c304373f1e20e631 (diff) | |
download | LegacyCamera-59a140990af1ba6d2c9aa627047a02e50c8dd0e1.zip LegacyCamera-59a140990af1ba6d2c9aa627047a02e50c8dd0e1.tar.gz LegacyCamera-59a140990af1ba6d2c9aa627047a02e50c8dd0e1.tar.bz2 |
Prevent NPE when handling messages.
bug:5238952
Change-Id: I56c65efb5798978aa76fbe1689317c6c021635a7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/panorama/PanoramaActivity.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index c840f7a..76771c5 100644 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -84,8 +84,7 @@ public class PanoramaActivity extends Activity implements private static final int MSG_LOW_RES_FINAL_MOSAIC_READY = 1; private static final int MSG_RESET_TO_PREVIEW_WITH_THUMBNAIL = 2; private static final int MSG_GENERATE_FINAL_MOSAIC_ERROR = 3; - private static final int MSG_DISMISS_ALERT_DIALOG_AND_RESET_TO_PREVIEW = 4; - private static final int MSG_RESET_TO_PREVIEW = 5; + private static final int MSG_RESET_TO_PREVIEW = 4; private static final String TAG = "PanoramaActivity"; private static final int PREVIEW_STOPPED = 0; @@ -246,19 +245,8 @@ public class PanoramaActivity extends Activity implements break; case MSG_GENERATE_FINAL_MOSAIC_ERROR: onBackgroundThreadFinished(); - mAlertDialog = (new AlertDialog.Builder(PanoramaActivity.this)) - .setTitle(mDialogTitle) - .setMessage(R.string.pano_dialog_panorama_failed) - .create(); - mAlertDialog.setButton(DialogInterface.BUTTON_POSITIVE, mDialogOk, - obtainMessage(MSG_DISMISS_ALERT_DIALOG_AND_RESET_TO_PREVIEW)); mAlertDialog.show(); break; - case MSG_DISMISS_ALERT_DIALOG_AND_RESET_TO_PREVIEW: - mAlertDialog.dismiss(); - mAlertDialog = null; - resetToPreview(); - break; case MSG_RESET_TO_PREVIEW: onBackgroundThreadFinished(); resetToPreview(); @@ -266,6 +254,20 @@ public class PanoramaActivity extends Activity implements clearMosaicFrameProcessorIfNeeded(); } }; + + mAlertDialog = (new AlertDialog.Builder(this)) + .setTitle(mDialogTitle) + .setMessage(R.string.pano_dialog_panorama_failed) + .create(); + mAlertDialog.setCancelable(false); + mAlertDialog.setButton(DialogInterface.BUTTON_POSITIVE, mDialogOk, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + resetToPreview(); + } + }); } private void setupCamera() { |