An oom situation occurs when an Android gridview loads a large number of pictures

Source: Internet
Author: User

One recently written application involves using the GridView display picture, and when using the Baseadapter traditional implementation, the Oom situation occurs when scrolling quickly on a real machine.
A temporary solution is to change the image size and reduce the memory. This method is simple but not secure. If there are enough pictures, there is still an oom situation.
An efficient way is to use asynchronous loading.

Get the maximum available memory for your application:

int maxMemory = (int) Runtime.getRuntime().maxMemory();  

You can also use the Convertview recycle view, combined with the Viewholder mode, to increase efficiency.

An oom situation occurs when an Android gridview loads a large number of pictures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.