方法一:
Uri updateUri = Uri.fromFile(file);
Intent updateIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, updateUri);
sendBroadcast(updateIntent);
方法二:
ContentValues localContentValues = new ContentValues();
localContentValues.put("_data", imageFile.toString());
localContentValues.put("description", "save image ---");
localContentValues.put("mime_type", "image/jpeg");
ContentResolver localContentResolver = getContentResolver();
Uri localUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
localContentResolver.insert(localUri, localContentValues);
参考:http://blog.sina.com.cn/s/blog_5689926f0100udgo.html
Android拍照后更新相册
时间: 2024-11-09 20:00:55