From 1011037364354a9371a39e407b98fae211e104d9 Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Thu, 27 Nov 2014 10:36:48 +0800 Subject: SnapdragonCamera: fix app crash when there is no map app ActivityNotFoundException happened after click showOnMap menu when there is no map app. Catch the Exception to avoid app crash. CRs-Fixed: 753928 Change-Id: I1cf6e5f098f239719750840508b715a08e9a5e45 --- src/com/android/camera/util/CameraUtil.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index 4cfc211bc..fd9bc13b1 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -1035,8 +1035,14 @@ public class CameraUtil { // Use the "geo intent" if no GMM is installed Log.e(TAG, "GMM activity not found!", e); String url = String.format(Locale.ENGLISH, "geo:%f,%f", latLong[0], latLong[1]); - Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - activity.startActivity(mapsIntent); + try { + Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + activity.startActivity(mapsIntent); + } catch (ActivityNotFoundException ex) { + Log.e(TAG, "Map view activity not found!", ex); + Toast.makeText(activity, activity.getString(R.string.map_activity_not_found_err), + Toast.LENGTH_SHORT).show(); + } } } -- cgit v1.2.3