Gallery App in android


Back after a long time! This time, I have an android app I created to share with you all.

What is it?

A gallery app in android

What are the features?

–  Creates a grid within the app

–  Where I can add images from camera or gallery and show thumbnails of the same in grid

–   Click open the thumbnail to show the image in fullsize

–   Delete the image and subsequently its thumbnail

–   Share the image to Facebook and other social media.


I was tired of searching for such an app online. because all of them either use SQlite DB or Content Providers. I tried both the approaches and they just didn’t fit the bill..

Here am consolidating the pros and cons of the approaches I tried and the one thats presented now.

My failed approaches

Storing images in a SQlite DB

Pros: Simple, fast adding and retrieval, easy on the VM’s budget. Writing the image as a byte array is much faster and easier to retrieve

Cons: Thumbnail image is decoded as byte array and shown as bitmap. This affects the clarity of the image very badly, when viewed full size.

Using Content Resolver to generate Thumbnails and show the fullsize image

Pros: There is no code from your side to generate thumbnails, Whenever a new image is added, query the Media Store to get the system generated thumbnail. Write the new image to a folder in sdcard, so full-size image looks perfect (as it is reading the original image from sdcard). Don’t forget to add user permissions in the manifest to mount/unmount media and to write to external storage(sdcard)

Cons:  Updating the media store is very slow. Again its a single line code to ask the media store to be rescanned to generate new thumbnail (for a newly added image) or to remove a thumbnail(in case of deleting the image from the grid). The lag is so obvious that you hardly like it.


My successful approach (Code in github. Link provided at the end of the post)

Generating Thumbnails on the fly. Here when a new image is chosen from gallery or by clicking a pic in the camera, the image is written to a folder in SD Card (again, don’t forget to include necessary permissions in the manifest. Refer AndroidManifest.xml in the code provided in github), and the thumbnail is created by generating a bitmap of the fullsized image. Setting the bitmapFactory options ‘s sample size high, saves you from out of memory errors.


Various screens from the app



Download the entire app here :

C ya :*


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s