Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Bitmaps use up a lot of memory is clear. You need to take care of the following to use bitmaps effectively</p> <ul> <li>Remember that your png's in drawables are automatically resized based on screen size by android. And that takes up a lot of memory. Android does not resize images if it finds images of its needed size / scale in the correct drawable folder. So to start with copy all ldpi files to hdpi too. This will reduce your memory utilization by 40% atleast. I know how this sounds, but this is true, profile your app using debuggable=true in the manifest, and heap utilization using ddms. Make the change and run exactly the same scenario, you will notice the 40% reduction.</li> <li>When you read your bitmap, scale it down. Dont use just <code>CreateBitmap</code>, since it will read the entire file and utilize a lot more memory. Instead use <code>BitmapOptions</code> and scale it down. To scale it down you first need to set your options, and then use this options as a parameter to your <code>CreateBitmap</code> call. <a href="https://stackoverflow.com/questions/3331527/android-resize-a-large-bitmap-file-to-scaled-output-file">Here</a> is a nice link. Search more on stackoverflow you will find some more interesting responses.</li> <li>If you have any files in your drawables that are 1024X512, scale them down. OR Create new files that are clear but smaller in size. Use these files for mdpi, delete ldpi. Use the 1024X512 for your hdpi folder.</li> <li>Explore the possibility of using smaller files, sort by size and play around with it a bit. The graphical view on eclipse for xml files is really neat, and relatively bug free. Use it.</li> <li>Edited : Dont forget to null your bitmap for garbage collection. This is most important.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload