aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-09-27 21:27:07 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-09-27 21:27:07 +0200
commitf4d6b676e94d12377b5a2833ce8da4ad9dfc2d05 (patch)
tree05899bfb6ac329f74b146a0d7881b39a1ffdfa2a /src/main/java/eu
parentbbbc30e8234f14c9f340e0c29bb6b91a4bf640ee (diff)
catch rare activity not found exception when opening downloaded files
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 2b48f19c9..7733edc7e 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -1,5 +1,6 @@
package eu.siacs.conversations.ui.adapter;
+import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -322,7 +323,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.messageBody.setText("");
}
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
- viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground,true));
+ viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground, true));
viewHolder.messageBody.setHighlightColor(activity.getResources().getColor(darkBackground ? R.color.grey800 : R.color.grey500));
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
viewHolder.messageBody.setTextIsSelectable(true);
@@ -612,10 +613,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
PackageManager manager = activity.getPackageManager();
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
if (infos.size() > 0) {
- getContext().startActivity(openIntent);
- } else {
- Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
+ try {
+ getContext().startActivity(openIntent);
+ return;
+ } catch (ActivityNotFoundException e) {
+ //ignored
+ }
}
+ Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
}
public void showLocation(Message message) {