将 Drawable 保存到磁盘并检索 - Android
我如何将可绘制对象保存到 SD 卡(自定义文件夹)并稍后检索它(假设我跟踪已保存项目的路径)。
谢谢, 费萨尔
how would I save a drawable to the SDcard (custom folder) and later retrieve it assuming im keeping track of the path of the saved item.
Thanks,
Faisal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您想从互联网下载图像?
您可以使用
FileOutputStream
来保存图像,并且可以使用File.mkdirs()
在SD卡上创建自定义目录。如果您想稍后加载图像,可以使用
BitmapFactory.decodeFile(String pathName)
。I assume you want to download images from Internet?
You can use
FileOutputStream
to save the images, and you can useFile.mkdirs()
to create custom directory on the SD Card.If you want to load the image later, you can use
BitmapFactory.decodeFile(String pathName)
.