668

I'm working with Android Studio 1.1 Preview 1. I noticed that when I create a new project I'm getting the following hierarchy:

Enter image description here

Mipmap folders for different DPIs, no more different DPIs drawable folders.

Should I put all my resources in the mipmap folders, or just the app icon?

Zoe
  • 27,060
  • 21
  • 118
  • 148
David
  • 37,109
  • 32
  • 120
  • 141
  • 5
    Check out this statement from the google blog spot link below :- "... because they are used at resolutions different from the device’s current density. For example, an xxxhdpi app icon can be used on the launcher for an xxhdpi device." This tells that some devices explicitly tries to use icons of different density rather than what current device density specifies. eg. some manufacturer might like to use bigger icons in the home screen than launcher screen, or smaller icons for notifications than than usual specification. We must thus identify such resources and place them in mipmap folders. – Rahul Thakur Apr 21 '15 at 10:59
  • 1
    The above comment is just an assumption on what I understand and might be wrong. – Rahul Thakur Apr 21 '15 at 11:00
  • There is quite a lot more info over here --> [mipmap drawables for icons](http://stackoverflow.com/questions/23935810/mipmap-drawables-for-icons) – Richard Le Mesurier Feb 03 '16 at 16:33
  • 1
    Google should add a Lint quick-fix for putting app-icons there. I've made a post about it here: https://code.google.com/p/android/issues/detail?id=219500 – android developer Aug 08 '16 at 08:02

1 Answers1

950

The mipmap folders are for placing your app/launcher icons (which are shown on the homescreen) in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.

According to this Google blogpost:

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

When referencing the mipmap- folders ensure you are using the following reference:

android:icon="@mipmap/ic_launcher"

The reason they use a different density is that some launchers actually display the icons larger than they were intended. Because of this, they use the next size up.

hong4rc
  • 3,999
  • 4
  • 21
  • 40
Joel
  • 14,861
  • 3
  • 27
  • 31
  • 195
    To clarify, the "app icons" in the quoted section are referring to launcher icons, not necessarily other icons. – CommonsWare May 19 '15 at 00:35
  • 57
    "because they are used at resolutions different from the device’s current density" what does this mean really? That's one of the most cryptic phrases in this release. – Kurovsky Jun 26 '15 at 15:17
  • 6
    When you are using them in your code make sure you are using (R.mipmap.icon_name) not (R.drawable.icon_name). – Sajidur Rahman Jul 12 '15 at 07:11
  • 18
    @southerton When a resource from *drawable* is requested, a bitmap is chosen from the folder that matches the current density. For example, the Nexus 5 chooses drawables from XXHDPI. The launcher may choose an icon from a different folder. The Nexus 5 launcher uses icons from XXXHDPI. http://stackoverflow.com/questions/25131077/whats-the-real-size-of-the-launcher-icon-on-nexus-5 – SharkAlley Jul 17 '15 at 23:21
  • 27
    @southerton The reason they use a different density is that some launchers actually display the icons larger than they were intended. Because of this, they use the next size up. – Richard Le Mesurier Jul 21 '15 at 13:08
  • 2
    What if I am using some images in my application which should change its size according to the pixel density of device? Should I place them in mipmaps or drawables? Please advice. – Ali_Waris Jan 01 '16 at 14:12
  • I have a question. I have put all the appropriate images in all the appropriate folders, but when I try to make an `ImageView` with the `android:src = "@drawable/myimg"/>, I get cannot resolve. Do I need the image to also be in the drawable folder as well as the sub folders? I have been stuck on this for the last 4 and a half hours, thanks for your help! –  Jan 23 '16 at 06:21
  • @NullPointer try `@mipmap/myimg` instead - as per comment #1 by Asthme. – Richard Le Mesurier Feb 03 '16 at 16:32
  • 2
    To be simple, Android system can take a bitmap in mipmap regardless of the screen resolution of the device where your app is installed. For example mipmap-xxxhdpi qualifier will provide launcher icon that can appear larger than usual on an xxhdpi device. – Mohan Feb 11 '16 at 12:29
  • can we choose different resolutions maually.. example xxxhdpi – user1517108 Feb 22 '16 at 15:06
  • 2
    any specific purpose to keep this new pattern where we already had **/drawable-XXX/** to defined these?? Any one !! – CoDe Aug 05 '16 at 08:48
  • 1
    Where does it say that other images should be in drawable folder? What does the launchers do in order to get a different density of the icons? Isn't Mipmap a way to scale the images better, by combining them or something? – android developer Aug 08 '16 at 07:32
  • @joel menu, tab, bottom and navigation drawer icons should go to `mipmap` or `drawable`? – JP Ventura Mar 15 '18 at 15:02
  • what if i have scalable vector graphic? that can be resized to any resolution so there is no need for specifying resolution – M.kazem Akhgary Oct 19 '18 at 09:55