Hubert Solecki
Hubert Solecki

Reputation: 2771

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:

Thanks in advance !

Upvotes: 0

Views: 96

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

No, there is no basic difference between icon and pictures .

android:src exists for ImageViews and its subclasses. You can think of this as the foreground.

You should use android:src instead android:icon="@drawable/ for better approach

App crashes because of OutOfMemory exceptions

Add android:largeHeap="true" in your manifest Application Tag.

See more here: https://developer.android.com/guide/topics/manifest/application-element.html#largeHeap

Upvotes: 2

Phantômaxx
Phantômaxx

Reputation: 38098

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

Upvotes: 1

Related Questions