handle unknown file types as text
This commit is contained in:
parent
7293976971
commit
a58d0a7c90
|
@ -140,7 +140,10 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
} else {
|
||||
final String path = item.getPath();
|
||||
final File file = new File(path);
|
||||
final String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(Utils.getFileExtension(path));
|
||||
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(Utils.getFileExtension(path));
|
||||
if (mimeType == null)
|
||||
mimeType = "text/*";
|
||||
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(Uri.fromFile(file), mimeType);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
|
Loading…
Reference in New Issue