The possible problems of ListView and its optimization

Source: Internet
Author: User

Occurrence: In Fragmentactivity, two adjacent fragment have a large number of data requests

1, guess the reason: the memory is really too small

Result: There is still an error after changing the memory of the big mobile phone

2, the need to show the data are reduced, but the amount of data requested is still very large

Result: This error still occurs

3. See links http://blog.csdn.net/lizhenmingdirk/article/details/30490789

Without the use of a background image, using a solid color, there will be no practical results: the same mistakes will still be reported

Result: This error still occurs

Two, ListView of cotton after investigation has three kinds of programs
1, asynchronous load picture (dual cache: Internal cache and SD card cache)
2, request 10 each time, require the user to continue to request the next 10 http://download.csdn.net/download/anyifeng5257/4841040
3. Add the picture in the GetView to the stack, start the asynchronous thread to load the picture from the top of the stack, and make sure the picture of the current display area is displayed first.
Adjust the load thread priority to thread.norm_priority-1 and do not clock slices with UI threads to make scrolling smoother. Source: Http://download.csdn.net/detail/dolaameng328/5054440#comment

Note that you must add the SD card to read and write permissions online This lazylist really can be used, but the transplant to my own application when there is a problem
Bitmapfactory Explicit Termination method "Close" not called
Mainly because the Infilestream is not closed. Correction scheme: HTTP://ASK.CSDN.NET/QUESTIONS/53

Bitmapfactory.options O2 = new Bitmapfactory.options ();
        O2.insamplesize = scale;
        FIS = new FileInputStream (f);
        b = Bitmapfactory.decodestream (FIS, NULL, O2);
        Fis.close ();
return b;
Solution Resolution: Use picture caching, cache the URL image, then read the cache
Note that you must add read and write access to the SD card

1, Filecache documents

The Getcachedir () method is used to get the/data/data//cache directory

The Getfilesdir () method is used to get the/data/data//files directory

Reference: http://www.cnblogs.com/liulipeng/archive/2013/02/22/2922733.html

http://blog.csdn.net/yuzhiboyi/article/details/8645730 2, SoftReference soft reference reason: http://www.linuxidc.com/Linux/ 2011-09/42288.htm
Principle: http://blog.csdn.net/kavendb/article/details/5935577


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.