SDカードにビットマップを保存していて、Intent.ACTION_MEDIA_MOUNTED
直後に呼び出しました。
ギャラリーに表示されますが、画像が表示されるまでに約 5 分かかります。瞬時にする方法はありますか?
File newFile = new File(newFilename);
if (newFile.exists()) {
newFile.delete();
}
try {
FileOutputStream out = new FileOutputStream(newFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));
Toast.makeText(context, "Photo will appear in the Gallery in a few minutes.", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}