将图片复制到内部存储器 [英] Copy image to internal memory

查看:93
本文介绍了将图片复制到内部存储器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何把一个映像复制到内存中并恢复之后呢?

How I copy a image to internal memory and recover after that?

推荐答案

您可以使用openFileOutput(以下组合)和Bitmap.com preSS()将图像存储到内部存储器。

You can use the following combination of openFileOutput() and Bitmap.compress() to store the image to the internal storage.

// Create a BitMap object of the image to be worked with
final 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 OutputStream
bm.compress(CompressFormat.JPEG, 90, fos);

这篇关于将图片复制到内部存储器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆