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

存储图片代码: 
 

String str1 = "icon.png";

FileOutputStream localFileOutputStream1 = openFileOutput(str1, 0);

Bitmap.CompressFormat localCompressFormat = Bitmap.CompressFormat.PNG;

bitmap.compress(localCompressFormat, 100, localFileOutputStream1);

localFileOutputStream1.close();

读取图片代码:

String localIconNormal = "icon.png";

FileInputStream localStream = openFileInput(localIconNormal);

Bitmap bitmap = BitmapFactory.decodeStream(localStream));







你可能感兴趣的:(android,String,存储)