我想在我的
Android设备上获取本地文件的内容类型.我的代码是
File file = new File(uploadPath.replace("file://","")); Uri uri = Uri.fromFile(file); ContentResolver contentResolver = getApplicationContext().getContentResolver(); String type = contentResolver.getType(uri);
我的上传路径是file:///storage/emulated/0/DCIM/Camera/20141016_181148.jpg.但是,我总是将我的类型设为null.这是为什么??
解决方法
如果uri方案不是content,则内容解析器将返回null://