2013-07-01 47 views

回答

0

圖像不能儲存在設備畫廊 - 畫廊只是顯示一切在您的手機上,除非它們與特定應用相關的存儲圖像。使用以下方法確定您應該在哪裏保存圖像。

private File getAbosoluteFile(String ralativePath, Context context) { 
    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { 
     return new File(context.getExternalFilesDir(null), ralativePath); 
    } else { 
     return new File(context.getFilesDir(), ralativePath); 
    } 
} 

將它們存儲在與應用程序相關的外部存儲,他們將抓住被顯示在設備的畫廊。嘗試使用新圖像,因爲圖像會在圖庫應用程序中緩存很長時間。

+0

想我可能已經找到的代碼流氓位! – Alex

+0

@Alex:可能是符號鏈接?此外,畫廊應用程序緩存在不同的文件縮略圖顯示 - 你確定你不是在談論它的路徑? –

+0

MediaStore.Images.Media.insertImage(getContentResolver(),file.getAbsolutePath(),file.getName(),file.getName()); – Alex