Created
March 20, 2013 14:25
-
-
Save nspo/5205062 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 ff4af50a4326956672989b335c21520189b6b49b Mon Sep 17 00:00:00 2001 | |
From: Nicolai Spohrer <[email protected]> | |
Date: Wed, 20 Mar 2013 15:20:31 +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