Search code examples
androidimageresizeiconsimage-resizing

Icon and picture sizes on Android


I'm having troubles with pictures all over my App. When I was developing it on a NEXUS 7, I used my pictures from a single drawable folder and they were displayed well. When I've tried on a smartphone, a NEXUS 5, the App crashed because of an OutOfMemory exceptions caused by the automatic picture resize made by Android to fit to the screen density and size, applied to all my pictures on an activity. I think I don't understand how it works... I'm using pictures on my custom action bar by setting then in the layout via src and these same pictures are used all over the App for another purposes like ListViewItem icons.

Principal questions:

  • Is their a difference between icons and pictures ?
  • Does an icon has to be named beginning with ic_ ?
  • Do I have to use android:icon="@drawable/ or android:src="@drawable/ ?
  • I have a picture 44x44 in the drawable folder, what I need to do to make the picture look the same size on every screen ? Do I have to resize it ?

Thanks in advance !


Solution

  • 1 - NO. Icons ARE pictures.

    2 - It doesn't really matter.
    It's just a suggested naming convention.

    3 - The second option, if you provide YOUR OWN graphic resources.
    The first one is to use Android system icons.

    4 - Please read this page.
    It would be too broad to explain it.
    And it's already well explained in the official docs.

    5 - Please, avoid MULTIPLE questions. ;)


    EDIT

    6 I forgot to mention a really enlighting reading: iconograpy