September 16, 2011

How to upload an icon and background on an Android Application


Last week, I discussed how to open the default packages of a new Eclipse project. Today, I am going to discuss one of the first things an Android developer needs to do, and that is get the icon and background working.

If you click on the res file on the Package Explorer, you will see a folder marked “drawable”. Depending on what version of Android you are programming in, you will see three sub-directory folders of hdpi, mdpi, and ldpi. Each of these folders has a different pixel measurement for its icons and background.

It is possible to put one size of icon or background in the file and have your application working, but if you want to optimize for all kinds of Android devices, it is best to find icons and background in all types of folders.

Unless you want the Android default icon to be your application’s icon, then you had better create one of your own. I found that I could use the paint program or other similar drawing program for that. You should probably save it as a PNG file. I also discovered using Microsoft Office Picture Manager can crop the image file square, preferably down to 200 x 200.

The Picture Manager program is also good for Resizing a photo, and you will need to resize it to 72 x 72 pixels for the hdpi, 48 x 48 pixels for the mdpi, and the 32 x 32 pixels for the ldpi.

You will then need to open up your “My Computer” file and save your re-sized icon images under the same name (icon.png) in the hdpi, mdpi, and ldpi files.

You will then need to right-click on the drawable file select “Refresh”. The icon.png images will be in the files, and this image will be the official icon of the application.

Getting a background for your application is similar, as you will need to save it as an image file in each of the sub-directories of drawable. The dimensions are different as hdpi is 800 x 400 pixels, 320 x 480 pixels for mdpi, and 320 x 420 for the ldpi. Like the icon file, you should save in all three of these files as background.png.

Unfortunately, the icon file does not automatically come up when the application runs. You will need to put it in the code, on the application itself:


This will bring up the background instead of the default black.

As for what you put on Android, I am learning about that more an more each day. I highly suggest going to the Android Developers website to learn more about that.

About the Author



yourDSA, your number one source of assistance and support.



Be the first to comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>