diff options
| author | Angus Kong <shkong@google.com> | 2011-09-14 16:33:52 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-14 16:33:52 -0700 |
| commit | 7debfb4ae64e710e2bea5ba2446407c29952b107 (patch) | |
| tree | 0cb4c688f6a3d9c0161c0de4351aaefda0e71eb0 /src | |
| parent | c24192e3b9a3d4f6e5e77e408fd4d91333b1275e (diff) | |
| parent | 59a140990af1ba6d2c9aa627047a02e50c8dd0e1 (diff) | |
| download | LegacyCamera-7debfb4ae64e710e2bea5ba2446407c29952b107.zip LegacyCamera-7debfb4ae64e710e2bea5ba2446407c29952b107.tar.gz LegacyCamera-7debfb4ae64e710e2bea5ba2446407c29952b107.tar.bz2 | |
Merge "Prevent NPE when handling messages."
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() { |
