将图像存储在应用程序内存中的最佳方法是什么? [英] What is the best way to store the image in the memory of app?

查看:27
本文介绍了将图像存储在应用程序内存中的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中使用了 sqlite db,现在我想允许用户自定义背景图片,让他们能够从他们的图库中选择一个.

I'm using sqlite db in my app and now I would like to allow user customize the background image make them able to select one from their gallery.

我应该只存储图像的路径并每次都简单地引用它还是应该如何将图像传输到某些文本并将其完全存储在我的数据库中?第二个选项可防止图片从图库中删除.但我想知道最合适的方式.

Should I just store the path to image and simpy refer to it every time or should I some how transfer the image to some text and store it completely in my db? The second option prevents in case of picture being deleted from gallery. But I would like to know the most appropriate way of doing that.

推荐答案

SQLite 的游标限制为 1Mb.因此,您可能无法将其完全存储在数据库中,当您去请求时,它可能会被截断.将图像的路径存储在数据库表中,并以这种方式访问​​它.

SQLite has a cursor limit of 1Mb. So, you will probably not be able to store it completely in the DB, when you go to to request it will probably be truncated. Store the path to the image in the database table, and access it that way.

这篇关于将图像存储在应用程序内存中的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆