2

My goal is have a simples screen with a grey map and each button that you click, one different part of the map get painted.

enter image description here

I try to put the how map in one picture and every time that you hit one button I will make visible one part of the map with colour, like:

enter image description here enter image description here

I'm using ConstraintLayout and I put one image above the other. In the end we should have this: enter image description here

But, When I try to open in my cellphone it get some "OutOfMemory" error, but each picture is like 13-16KB, not to much. Before I call this Activity I closed all activity with intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

I make a test and all my java code is commented and my xml is almost all commented, if I have one or two pictures work, but if I put the third one give the error.

I start to thing this is something about the empty space in PNG.

But I'm not sure, any ideas or solutions? Thanks.

Canato
  • 3,598
  • 5
  • 33
  • 57

2 Answers2

0

Start allocation tracking then u will see which methods takes that memory. Memory size of image is not that important. It could scale up and u got a lot of images. Tint is that attribute u look for.

Janusz j.
  • 110
  • 2
  • 11
  • The problem is use tint programmatically, because the only solution that I saw until now is like a filter. Don't work like the tint in .xml – Canato Dec 15 '17 at 01:03
0

Use Android Profiler (a bottom tab) to see a memory allocation. If your chart increases slowly (maybe up to 100 Mb or more) it won't crash an application.

CoolMind
  • 26,736
  • 15
  • 188
  • 224