android - 如何使用 Volley 从服务器 url 将图像插入到 sqlite 中?

标签 android sqlite

<分区>

我正在使用 volley 在用户在线时向他们显示图像和其他数据(如(名称、描述))。它工作正常。我想将图像和数据保存在 sqlite 中,以便用户在没有互联网连接时可以看到它们。我知道如何从 sqlite 插入和检索数据,但我不知道如何将图像从 url 插入到 sqlite。谁能建议我该怎么办?谢谢你

最佳答案

在 sqlite 中存储图像有很多选择:

  1. 将您的位图转换为 base64 并将 Base64 图像字符串存储到您的数据库。

  2. 将从 url 下载的位图存储在缓存内存中,并将缓存路径存储在数据库中。

  3. 将服务器 url 存储在 db 中,并使用 imageLoader 从 url 下载并显示图像。

关于android - 如何使用 Volley 从服务器 url 将图像插入到 sqlite 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41584204/

相关文章:

java - 在 begin...end 内更改 SpriteBatch 投影矩阵是个好主意吗?

android - Google Play 结算库 : Determine base plan/expiry of subscription purchase

android - 删除行的 SQLite 查询不起作用

java - SQLite 数据库更新

python - 从sql查询中重新组合python中的时间列表

android - Android 中如何知道 View 处于触摸状态

android - Google Play "Native platforms"显示 commons-io-2.4.jar

c# - 将sqlite数据库同步到MYSQL数据库

android - flutter中实现自定义底部导航栏

python - 如何使用 SQLAlchemy 获取一条记录?