android 存儲圖片到data目錄和讀取data目錄下的圖片 – Android移動開發技術文章_手機開發 Android移動開發教學課程

</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的專欄

發佈留言