当前位置:操作系统 > 安卓/Android >>

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

</pre>存储图片代码:<p><pre name="code" class="java">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));

摘自 xiaoxiaobian3310903的专栏

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,