Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the best practice store images in android in SD card or in SQL lite DB?

I want to store sample images. what is the best efficient way weather to store on SD card or in DB?

like image 616
AZ_ Avatar asked Dec 27 '10 13:12

AZ_


People also ask

Can you store images in a SQLite database?

Inorder to store images to android SQLite database, you need to convert the image uri to bitmap then to binary characters that is, bytes[] sequence. Then set the table column data type as BLOB data type. After retrieving the images from DB, convert the byte[] data type to bitmap in order to set it to imageview.

Where does SQLite store data in Android?

The Android SDK provides dedicated APIs that allow developers to use SQLite databases in their applications. The SQLite files are generally stored on the internal storage under /data/data/<packageName>/databases.

What is the maximum size of SQLite database in Android?

Maximum Database Size The maximum size of a database file is 4294967294 pages. At the maximum page size of 65536 bytes, this translates into a maximum database size of approximately 1.4e+14 bytes (281 terabytes, or 256 tebibytes, or 281474 gigabytes or 256,000 gibibytes).


1 Answers

if the images are not big(2-3 KB) and the collection of them is not supposed to be expanded then you can save them to db. But it would be harder to write them, read them. On the other hand the user won't be able to do anything with them.

Otherwise, if you want to let user to expand the image collection or the images are rather big you should store them to sd card.

Anyway, you should be aware of space lackness and treat those cases appropriately.

like image 126
Vladimir Ivanov Avatar answered Oct 27 '22 17:10

Vladimir Ivanov