android 存储图片到data目录和读取data目录下的图片
16lz
2021-01-23
存储图片代码:
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中简单的图片翻页效果
- android从相册中获取图片并将其显示在当前界面
- Android 使用 DowanloadManager 实现下载并获取下载进度实例代码
- 如何让Android支持GIF图片
- Android Design: 九种常见Activity及代码解析之"Login Activity"
- Android实现下载图片并保存到SD卡中
- android中实现从相册中一次性获取多张图片与拍照,并将选中的图片