修复了保存图片但是系统图库没有显示的问题
This commit is contained in:
@ -370,7 +370,7 @@ public class MessageShareUtils {
|
||||
if (isToast) {
|
||||
Utils.toast(mContext, "图片已保存到/Pictures/ghzhushou/");
|
||||
//刷新手机图片库
|
||||
refreshImage(_file, mContext);
|
||||
refreshImage(mContext, _file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -388,12 +388,15 @@ public class MessageShareUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshImage(File _file, Context context) {
|
||||
/**
|
||||
* 注意,第二个入参需要是 file 本身而不是 folder
|
||||
*/
|
||||
public static void refreshImage(Context context, File imageFile) {
|
||||
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
Uri uri = Uri.fromFile(_file);
|
||||
Uri uri = Uri.fromFile(imageFile);
|
||||
intent.setData(uri);
|
||||
context.sendBroadcast(intent);
|
||||
Utils.log("保存分享图片路径:" + _file.getAbsolutePath());
|
||||
Utils.log("保存分享图片路径:" + imageFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
class ShareRecyclerViewAdapter extends RecyclerView.Adapter<ShareRecyclerViewAdapter.ViewHolder> {
|
||||
|
||||
Reference in New Issue
Block a user