如何从android资源URI获取MIME类型?
URI看起来像:
android.resource://com.package.name/drawable/resourceName
我试过
ContentResolver cR = context.getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
mimetype = mime.getExtensionFromMimeType(cR.getType(uri));
但返回的MIME类型为null
和
String url = uri.toString();
String extension = MimeTypeMap.getFileExtensionFromUrl(url);
mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
但没有延期...