How to open file with any exetension in Android?
The following code will work for every file type:
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), fileMimeType);
startActivity(intent);
} catch (ActivityNotFoundException e) {
// no Activity to handle this kind of files
}
Of course, there should be an Activity
in the system that knows how to handle the file of a certain type. Hope this helps.