catch rare activity not found exception when opening downloaded files
This commit is contained in:
parent
bbbc30e823
commit
f4d6b676e9
|
@ -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;
|
||||
|
@ -612,11 +613,15 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
PackageManager manager = activity.getPackageManager();
|
||||
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
|
||||
if (infos.size() > 0) {
|
||||
try {
|
||||
getContext().startActivity(openIntent);
|
||||
} else {
|
||||
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
|
||||
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) {
|
||||
for(Intent intent : GeoHelper.createGeoIntentsFromMessage(message)) {
|
||||
|
|
Loading…
Reference in a new issue