android 存储图片到data目录和读取data目录下的图片

转载自:http://blog.csdn.net/xiaoxiaobian3310903/article/details/7042067



存储图片代码:

String str1 = "icon.png";

FileOutputStream localFileOutputStream1 = openFileOutput(str1, 0);

Bitmap.CompressFormat localCompressFormat = Bitmap.CompressFormat.PNG;

bitmap.compress(localCompressFormat, 100, localFileOutputStream1);

localFileOutputStream1.close();

读取图片代码:

calIconNormal = "icon.png";

FileInputStream localStream = openFileInput(localIconNormal);

Bitmap bitmap = BitmapFactory.decodeStream(localStream));


你可能感兴趣的:(android 存储图片到data目录和读取data目录下的图片)