catch exception on broken android phones

This commit is contained in:
Daniel Gultsch 2015-07-12 20:17:12 +02:00
parent 558d065d48
commit 84bfe8c721
1 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
import android.app.AlertDialog;
import android.app.Fragment;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -513,7 +514,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
shareIntent.setType(mime);
}
activity.startActivity(Intent.createChooser(shareIntent, getText(R.string.share_with)));
try {
activity.startActivity(Intent.createChooser(shareIntent, getText(R.string.share_with)));
} catch (ActivityNotFoundException e) {
//This should happen only on faulty androids because normally chooser is always available
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
}
}
private void copyText(Message message) {