Papi
Papi

Reputation: 97

to much usage RAM for application

I would like to reduce memory consumption. My application is small and consumes between 20-45 mb of RAM. The problem arises when I add a lot of new things and objects means that soon we get error out of bounds.

I have got situation like that:

How can i change and try to make smaller usage for ram. i think it is urgently now. I need suggestions for profesional programers :) How can i free a memory for variables wich i dont need anymore, and how can i delete button,image button and other thinks from ram

thanks for all suggestion,

lp piki12

Upvotes: 1

Views: 152

Answers (1)

Ryan S
Ryan S

Reputation: 4567

A good place to start with RAM reduction are bitmaps as they inherently use a lot of RAM. Instead of loading a full bitmap into memory, it is much more efficient to only load the bitmap at a resolution to match the screen. I recommend you look at: https://github.com/nostra13/Android-Universal-Image-Loader which makes this very easy to do.

EDIT: As the question ends up to be using Canvas, this option is not available. Instead you have to implement this: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html. It's still not that difficult as the majority of the code is provided.

Upvotes: 1

Related Questions