Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient Way to store images in android

My application requires that when a snapshot is taken it must store in memory and next time when I restart the phone I must get a thumbnail of that photo in list of photos and the full scale photo when I click on it.

There are 2 ways I know.

  1. Store images directly. Concern here is every time it has to hit directory to get image which takes some time.
  2. Store all images in single xml. Concern here is XML will be too big and takes time to parse

Which is more efficient ?

like image 559
Prabhat Avatar asked Aug 03 '10 03:08

Prabhat


People also ask

How do I store photos on Android?

This example demonstrates How to write an image file in internal storage in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

Is it good to store images in Elasticsearch?

Storing whole images in Elasticsearch will not be very beneficial, because if the image is scaled/cropped and then used as a query, it will give incorrect results.

What is the best way to store images in Web application?

Store the images as a file in the file system and create a record in a table with the exact path to that image. Or, store the image itself in a table using an "image" or "binary data" data type of the database server.


Video Answer


1 Answers

Definitely store the images directly as opposed to in XML. It will take time to read the image from the file system but I wouldn't worry about this taking an excessively long time.

Read through the android docs on Data Storage for more info: http://d.android.com/guide/topics/data/data-storage.html

like image 55
m6tt Avatar answered Oct 06 '22 09:10

m6tt