我在 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();
}