當(dāng)我們知道一個(gè)文件的路徑,如何調(diào)用系統(tǒng)文件管理器顯示它的位置呢骗随。
代碼:
//getUrl()獲取文件目錄蛤织,例如返回值為/storage/sdcard1/MIUI/music/mp3_hd/單色冰淇凌_單色凌.mp3
File?file?=newFile(getUrl());
//獲取父目錄
File?parentFlie?=newFile(file.getParent());
Intent?intent?=newIntent(Intent.ACTION_GET_CONTENT);
intent.setDataAndType(Uri.fromFile(parentFlie),"*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivity(intent);