Site icon 咖啡偶-IT日常

Android App新增檔案,但系統並未發現有新的檔案

Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(<新檔案名稱(含路徑)>);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
<your activity>.sendBroadcast(mediaScanIntent);


Exit mobile version