更新手机图库

原理:先往图库中插入图片路径,然后发送广播通知更新图库列表

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/

原文地址:https://www.cnblogs.com/anni-qianqian/p/8004178.html