Created
March 20, 2013 14:13
-
-
Save nspo/5204959 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 593ff8b6a854df5cf3695dd571592cca8e204075 Mon Sep 17 00:00:00 2001 | |
From: Nicolai Spohrer <[email protected]> | |
Date: Wed, 20 Mar 2013 15:08:00 +0100 | |
Subject: [PATCH] Fix unhandled ActivityNotFoundException if no Play Store is | |
installed on device (e.g. emulator) | |
--- | |
AppRate/src/com/tjeannin/apprate/AppRate.java | 8 ++++++-- | |
1 file changed, 6 insertions(+), 2 deletions(-) | |
diff --git a/AppRate/src/com/tjeannin/apprate/AppRate.java b/AppRate/src/com/tjeannin/apprate/AppRate.java | |
index c31e5c1..8dcdc21 100644 | |
--- a/AppRate/src/com/tjeannin/apprate/AppRate.java | |
+++ b/AppRate/src/com/tjeannin/apprate/AppRate.java | |
@@ -225,7 +225,11 @@ public class AppRate implements android.content.DialogInterface.OnClickListener, | |
switch (which) { | |
case DialogInterface.BUTTON_POSITIVE: | |
- hostActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + hostActivity.getPackageName()))); | |
+ try { | |
+ hostActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + hostActivity.getPackageName()))); | |
+ } catch (ActivityNotFoundException e) { | |
+ Toast.makeText(hostActivity, "No Play Store installed on device", Toast.LENGTH_SHORT).show(); | |
+ } | |
editor.putBoolean(PrefsContract.PREF_DONT_SHOW_AGAIN, true); | |
break; | |
@@ -264,4 +268,4 @@ public class AppRate implements android.content.DialogInterface.OnClickListener, | |
} | |
return (String) (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : "(unknown)"); | |
} | |
-} | |
\ No newline at end of file | |
+} | |
-- | |
1.7.10.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment