2011-07-13 80 views

回答

10

您需要call the MediaScanner这样它才能知道你的文件存在:

File file; // = your file 
String mimetype; // = your file's mimetype. MimeTypeMap may be useful. 
MediaScanner.scanFile(getApplicationContext(), new String[]{file.getPath()}, new String[]{mimetype}, null); 
+0

任何示例如何使用这个请吗? :) – Maurice

+0

没关系把它在这里。 http://stackoverflow.com/questions/5107823/force-scan-files-after-taking-photo – Maurice

+0

哎呀,这是错的,让我再看看。 –

0

尝试这个答案。为我工作

context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(finalFile)));