From f121ea2549edecf769ef15faca6d4b8ee88c7377 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 20 Jan 2017 18:49:14 +0800 Subject: [PATCH] Prevent crashing when no market is installed --- mobile/src/main/res/xml/pref_profile.xml | 9 +++++---- .../scala/com/github/shadowsocks/ProfilesFragment.scala | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mobile/src/main/res/xml/pref_profile.xml b/mobile/src/main/res/xml/pref_profile.xml index 80b104e7..e2784a69 100644 --- a/mobile/src/main/res/xml/pref_profile.xml +++ b/mobile/src/main/res/xml/pref_profile.xml @@ -2,13 +2,14 @@ + + - Toast.makeText(getActivity, R.string.add_profile_scanner_not_installed, Toast.LENGTH_LONG).show() - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=tw.com.quickmark"))) + try startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=tw.com.quickmark"))) catch { + case exc: ActivityNotFoundException => exc.printStackTrace() + } } true case R.id.action_import =>