Tôi đang cố gắng lấy loại nội dung của tệp cục bộ trên thiết bị Android của mình. Mã của tôi làContentResolver luôn trả về null
File file = new File(uploadPath.replace("file://",""));
Uri uri = Uri.fromFile(file);
ContentResolver contentResolver = getApplicationContext().getContentResolver();
String type = contentResolver.getType(uri);
Đường dẫn tải lên của tôi là file:///storage/emulated/0/DCIM/Camera/20141016_181148.jpg
. Tuy nhiên, tôi luôn nhận được số type
là không có giá trị. Tại sao vậy??
Bất kỳ giải pháp nào cho vấn đề này? tôi vẫn nhận được null –