summaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorH. Lehmann <ByteHamster@users.noreply.github.com>2019-09-26 18:52:01 +0200
committerGitHub <noreply@github.com>2019-09-26 18:52:01 +0200
commit1e883758e4de47fe6f9dccec09c1979cb9ae93e5 (patch)
tree15a001f47cd5a76930de88c670bd5f1d5c5c1361 /core/src/main
parent1cb30ef27131c12d5ab8c7885db5b3d1c6ae1552 (diff)
parentb65c688b53779f436062d33517f95b2c0a29733c (diff)
downloadAntennaPod-1e883758e4de47fe6f9dccec09c1979cb9ae93e5.zip
Merge pull request #3451 from ByteHamster/fix-no-browser-installed
Fixed crash if there is no browser installed
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java
index e81ab47ed..656b518bf 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java
@@ -1,13 +1,20 @@
package de.danoeh.antennapod.core.util;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.util.Log;
+import android.widget.Toast;
+import de.danoeh.antennapod.core.R;
import java.util.List;
public class IntentUtils {
+ private static final String TAG = "IntentUtils";
+
private IntentUtils(){}
/*
@@ -28,4 +35,13 @@ public class IntentUtils {
context.sendBroadcast(new Intent(action).setPackage(context.getPackageName()));
}
+ public static void openInBrowser(Context context, String url) {
+ try {
+ Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ context.startActivity(myIntent);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(context, R.string.pref_no_browser_found, Toast.LENGTH_LONG).show();
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
+ }
}