featuredtipsogtricks

How to change the icon of your Android app

This is just a small follow-up post to The easiest way to create nice icons for Android apps.

Say, if you follow that guide, and have made an icon to represent your app, how do you use it?

If you have one icon image, or three icon images (one for each screen density, ldpi, mdpi and hdpi, like in the guide), you put your icon files in the res/drawable folder where they belong.

Depending on what API level you are creating your Android application for, in your “res” folder you either have one folder called “drawable” or four folders named:

  • /drawable-ldpi
  • /drawable-mdpi
  • /drawable-hdpi
  • /drawable-xhdpi.

For application launcher icons, the sizes are:

Low density ldpi 120 dpi 36×36 px
Medium density mdpi 160 dpi 48×48 px
High density hdpi 240 dpi 72×72 px
Extra High density xhdpi 320 dpi 96×96 px

 

When you have put your icon in the folder/folders, open up your AndroidManifest.xml file and choose to view it as XML.

For a new Android application, the AndroidManifest.xml file will look like this:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="test.application"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".YourAppName"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

And on line 6 you can see the attribute that specifies your applications icon:

android:icon="@drawable/icon"

The /icon refers to the default icon.png file in your drawable folder (or the drawable-ldpi/mdpi/hdpi/xhdpi folders), so just substitute “icon” with the name of your icon file, you will change the icon of your app.

  • Raonaeemqasimqasim

    I try to change my application icon picture by replacing icon.png picture with my desigred pic in drawable.hdpi,drawable.ldpi and mdpi but it give me error can any body help me how to change application icon. Thanks in advance

    • D69oh Ds

      i believe i’m having the same trouble it’s a crc error i have no answer to the problem just hopefully adding more info to the problem. It happens to me changing the icon.png, the icon will change but then the other png’s will become currupted and their pic will go away, when running a test it will say crc error.

  • EnvyAndroid

    Hi
    what was the error?
    Is the name in your manifest file (android:icon=”@drawable/icon”) equal to the name of your 3 images minus the file extension? (icon.png)
    Is it a .png image?

  • Lilsis812

    Please tell me how to change the text color inside the app drawer.. or if it’s possible to apply a bubble background for the text like in the home screen. thank you!

    • EnvyAndroid

      Hi
      I think that depends on what launcher you are using. You may want to look into LauncherPro or maybe ADWLauncher EX, maybe they have some customization options for you. :)

      I don’t think it’s possible to specify a special text color (for the app drawer) in your app.

      • Acke0009

        No the text color isn’t controlled by the app that installed it.

  • http://twitter.com/svenho_O Sven

    you saved me time of my life… i justed replaced the standard icon.png’s with my app icons – but somewhere between my IDE and my Nexus S the old standard icons were cached so I never got my customized icons on my phone.

    But changing the “icon” image name in the manifest to something custom and so changing my icon-names solved the problem… little information, but huge impact in my case!

  • Raju

    icon doesn’t fit to actual space even if we create 96*96 size, there will be space around icon with different color, how to change that color to icon background color?

    • EnvyAndroid

      You can create the background as alpha channel (transparent) in png images, would that solve your problem? :)

      • Raju

        sorry i am talking about default android application icon, which comes in different color, after adding my custom icon, my icon comes inside android default application icon, so i want change application color

    • fraink

      72*72

  • Bibbleskit

    did that already. no change on the home screen or in the menu. whats the problem?

  • Guest

    Thank you very much…..

  • Asd

    thank you

  • Steve

    What Sven says goes for me too!! Thanks very much.

  • Test

    xhdpi is 96×96

  • Aasha

    Thank you…:)

  • Vitthal Patel

    When I try to change app_icon as per the guidelines given above I get an error. When I change icon name in androidmanifest.xml if says me “aapt:no resource found that matches the given name (at ‘icon’ with value ‘@drawable/cs_icon.png’). cs_icon.png is an image I selected to be shown as icon og my app. I have stored that image in all four /drawable folders (ldpi,mdpi,hdpi, and xhdpi). Even it shows red line inder the word <application. Please help me to resolve

    • EnvyAndroid

      It may be that you have to update the R resource file?
      Try going to Project -> clean