从Android中保存SQLite数据库中的图像 [英] Save image in SQLite database from Android

查看:162
本文介绍了从Android中保存SQLite数据库中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于在应用程序的SQLite数据库位置保存图像的问题。

I have a question about saving images in an SQLite database location in the app.

我为iOS制作了一个应用程序,用户可以在其中拍照或抓住现有照片一个来自应用程序的应用程序将它们保存在自己的应用程序中的本地银行,因为IOS没有太多的磁盘空间问题。

I made an app for iOS where users can snap a photo or grab an existing one from the app that saves them in a local bank in own app, since the IOS does not have so many problems with disk space.

在Android上已经有代码需要照片或使用现有的照片,现在想知道如何将它们保存在SQLite数据库中。 (?)

On Android already have code that takes the photo or use an existing one, now wanted to know how save them in SQLite database. (?)

我一直在阅读并且有人建议将图像保存在SD卡中并仅将图像路径插入数据库,但如果由于某种原因它是从SD卡中排除将在您的应用程序中出现错误,因为引用的路径不再存在。

I've been reading about and some suggest saving the image in SD card and insert into the database only the image path, but if for some reason it is excluded from the SD card will have an error in your application for the path referenced no longer exists.

对此有什么理想的解决方案?

What would be the ideal solution for this?

推荐答案

你应该只保留数据库中的图片名称并将图片存储在内部存储器上,而不是存储在SD卡上,将它们保存在第一个仅作为私人申请。

You should only keep the name of the picture in the database and store the picture on the internal storage, not on the sdcard, save them in the first place as private to your application only.

这篇关于从Android中保存SQLite数据库中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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