0

I am trying to load an activity with a lot of pictures that serve as logo and buttons. Apparently it crashes because there is not enough memory to support them.

What is the best or most efficient way to do sucha thing, as load the pictures I want without problems ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 1
    Reduce the size of your images. Even better, try using **something else**. Try using drawables, 9 patches, SVGs, VectorDrawables, ... anything that can save you from using bitmaps (with the exception of 9 patches). – Phantômaxx May 12 '16 at 21:11
  • Possible duplicate of [How to solve java.lang.OutOfMemoryError trouble in Android](http://stackoverflow.com/questions/25719620/how-to-solve-java-lang-outofmemoryerror-trouble-in-android) – OneCricketeer May 12 '16 at 21:28
  • My pictures are in .png format, and they are about 28 KB. How smaller can they get ? – Alkiviadis95 May 12 '16 at 21:58
  • In memory, they become `x * y * 4 * dpi_scale_factor` – Phantômaxx May 13 '16 at 07:51

1 Answers1

0

I had look like this problem when use Genymotion emulator.so when i switch to default emulator of android studio this problem fixed although android studio emulator had less than memory than Genymotion emulator. if your algorithms haven't problem but your application crashed you can use some technick look like cache. also if your image size is large you can reduce image size but you must have attention this work can reduce image resolution

Sina Soheili
  • 121
  • 1
  • 1
  • 11