I know how to lunch another activity, But how do I meke sure an activity exist for my MIME type before starting the activity? for example if I have a PDF file that I want to display, how do I make sure a PDF viewer exist?
here is the code I use to lunch the PDF viewer
MimeTypeMap tMimeType = MimeTypeMap.getSingleton();
String tMimeStr = tMimeType.getMimeTypeFromExtension("pdf");
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile("xyz.pdf"), tMimeStr);
try
{
startActivity(intent);
}
catch (Exception e)
{
// Display error message here
}