将 Drawable 保存到磁盘并检索 - Android

发布于 2024-08-09 20:28:44 字数 70 浏览 2 评论 0原文

我如何将可绘制对象保存到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鲜肉鲜肉永远不皱 2024-08-16 20:28:44

我假设您想从互联网下载图像?

您可以使用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 use File.mkdirs() to create custom directory on the SD Card.

If you want to load the image later, you can use BitmapFactory.decodeFile(String pathName).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文