android – 将图像复制到内存

android – 将图像复制到内存,第1张

概述我如何将图像复制到内部存储器并在此之后恢复? 您可以使用openFileOutput()和Bitmap.compress()的以下组合将图像存储到内部存储. // Create a BitMap object of the image to be worked withfinal Bitmap bm = BitmapFactory.decodeStream( ..some image.. ); 我如何将图像复制到内部存储器并在此之后恢复?解决方法 您可以使用openfileOutput()和Bitmap.compress()的以下组合将图像存储到内部存储.

// Create a BitMap object of the image to be worked withfinal Bitmap bm = BitmapFactory.decodeStream( ..some image.. );// The openfileOutput() method creates a file on the phone/internal storage in the context of your application final fileOutputStream fos = openfileOutput("my_new_image.jpg",Context.MODE_PRIVATE);// Use the compress method on the BitMap object to write image to the OutputStreambm.compress(CompressFormat.JPEG,90,fos);
总结

以上是内存溢出为你收集整理的android – 将图像复制到内存全部内容,希望文章能够帮你解决android – 将图像复制到内存所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1123026.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存