diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-08-17 17:18:12 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-08-17 17:18:12 +0200 |
commit | 7c4715128cdd301a354f3e5d3eee1f9db7e55419 (patch) | |
tree | 7f23bec87fed2c4d50873204b2a6f27243b4cc8c /src/de/danoeh/antennapod/fragment | |
parent | 462ff3cadc0c0c25d693b8028d0757cb82f1759e (diff) | |
download | AntennaPod-7c4715128cdd301a354f3e5d3eee1f9db7e55419.zip |
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.
Diffstat (limited to 'src/de/danoeh/antennapod/fragment')
-rw-r--r-- | src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java | 13 |
1 files changed, 8 insertions, 5 deletions
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; } |