From 7c4715128cdd301a354f3e5d3eee1f9db7e55419 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sat, 17 Aug 2013 17:18:12 +0200 Subject: Catch ActivityNotFoundException to prevent crash. This problem occurred with some podcasts using embedded youtube videos. In these cases, the 'http:"-part of the URL was missing and therefore, no activity for viewing the URL was found. --- .../danoeh/antennapod/fragment/ItemDescriptionFragment.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/de/danoeh/antennapod/fragment') diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 9183180c1..eb396251f 100644 --- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.fragment; +import android.content.*; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import de.danoeh.antennapod.feed.FeedItem; @@ -9,10 +10,6 @@ import org.apache.commons.lang3.StringEscapeUtils; import android.annotation.SuppressLint; import android.app.Activity; -import android.content.ClipData; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; import android.content.res.TypedArray; import android.net.Uri; import android.os.AsyncTask; @@ -117,7 +114,12 @@ public class ItemDescriptionFragment extends Fragment { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - startActivity(intent); + try { + startActivity(intent); + } catch (ActivityNotFoundException e) { + e.printStackTrace(); + return false; + } return true; } @@ -138,6 +140,7 @@ public class ItemDescriptionFragment extends Fragment { } }); + registerForContextMenu(webvDescription); return webvDescription; } -- cgit v1.2.3