原理:先往圖庫中插入圖片路徑,而後發送廣播通知更新圖庫列表android
private static void updatePhonePic(String fileName, String filePath) { try { MediaStore.Images.Media.insertImage(App.getApplication().getContentResolver(), filePath, fileName, null); } catch (FileNotFoundException e) { e.printStackTrace(); } App.getApplication().sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(filePath))); }
參考文檔:http://stormzhang.com/android/2014/07/24/android-save-image-to-gallery/spa