Dear sir,
I'm trying to write an apps just like a file manager. my code is as
follow:
private void openFile(File f)
{
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
String mExt = MimeTypeMap.getFileExtensionFromUrl(f.getName());
String mMimetype =
MimeTypeMap.getSingleton().getMimeTypeFromExtension(mExt);
String type = mMimetype;
type += "/*";
intent.setDataAndType(Uri.fromFile(f), type);
startActivity(intent);
}
After I run the programme, some of the file like (mp4, jpg) can open
the dialog to select the application. but other then that, it found
error and force close the app. How can I do if I want to run e.g.
application/msword, applciation/pdf... etc.?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en