把保存在某位置的图片插入到图库中

    private void insertThumb(String fileName, String filePath, String pathUri) {
        try {
            MediaStore.Images.Media.insertImage(App.getInstance().getContentResolver(), filePath, fileName, null);
            Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
            intent.setData(pathUri);
            App.getInstance().sendBroadcast(intent);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

猜你喜欢

转载自blog.csdn.net/j550341130/article/details/79218595