bitmap 保存到图片文件


val file = File(
requireContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES),
"tmp_${System.currentTimeMillis()}.jpg"
)
val bos = BufferedOutputStream(FileOutputStream(file))
bitmap?.compress(Bitmap.CompressFormat.JPEG, 100, bos)
bos.flush()
bos.close()
posted @ 2022-04-21 11:47  荣超  阅读(419)  评论(0)    收藏  举报