首页 > 代码库 > Android拍照后更新相册

Android拍照后更新相册

方法一:

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