From 330b2732fd917a56badb96f6307c311a8e4661bb Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 12 Nov 2020 12:18:30 +0800 Subject: Fix email client not found. --- .../infinityforreddit/Settings/AboutPreferenceFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java index 71e9dbc6..640c8398 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Settings; import android.app.Activity; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -74,9 +75,9 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat { emailPreference.setOnPreferenceClickListener(preference -> { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com")); - if (intent.resolveActivity(activity.getPackageManager()) != null) { + try { startActivity(intent); - } else { + } catch (ActivityNotFoundException e) { Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show(); } return true; -- cgit v1.2.3