0

I am trying to create a picker for images inside my app and I am having hard times with memory management. The pics are high resolution camera pictures, with 5mb each (minimum).

When showing the picker, which is a GridView.builder builder The app starts lagging so much, and it starts displaying the images late and it is not good visually specially when I have to display 12 pictures at once.

The Console would start showing the memory trimming debug messages and a strange for input counter message.

For input string: "-1,433"
V/ActivityThread(19862): Trimming memory to level: 10
V/ActivityThread(19862): Trimming memory to level: 15
For input string: "-1,399"
For input string: "-1,444"
For input string: "-1,394"
For input string: "-1,357"
For input string: "-1,271"
For input string: "-1,229"
For input string: "-1,136"
For input string: "-1,201"
For input string: "-1,154"
Lost connection to device.

Please help. how do I deal with this? Is there anyway other than manually creating thumbnails of each photo in the background and using it ?

Kaki Master Of Time
  • 1,428
  • 1
  • 21
  • 39

1 Answers1

0

You don't need to create thumbnails manually. You should be able to resize your images before using them with this answer's help. After resizing at app's first start, you can always use them by checking if the images are already resized at every app start.

Hugo Passos
  • 7,719
  • 2
  • 35
  • 52