Android Small Notes

Source: Internet
Author: User

Public View GetView (int position, View Convertview, ViewGroup parent) {



View Convertview: The value that appears at startup is cached in (View) Convertview


If it is currently empty, the layout is loaded

View view;

if (cenvertview==null) {

View = View.inflate (Getapplicationcontext (), r.layout.lv_item,null);

}

//If not empty, assign the cached value to the view

else{

View=convertview;

}

TextView tv_name = (TextView) View.findviewbyid (r.id.tv_name);

TextView Tv_phone = (TextView) View.findviewbyid (R.id.tv_phone);

}

Statement Description:


Loads a bunch of content when the app starts, and the loaded content is placed in the view, such as when you move the page up and down, and you keep loading data into the view. This takes up a lot of memory, the content of the time is good, if the content of more, the memory will be very large. This is the time for caching optimizations. The IF statement to determine whether the content will be loaded in the cache of the view is empty, if it is empty, load the data, if not empty, the loaded content is assigned to the view, this does not need to load the data again. This enables caching optimizations.

about the matches regular expression of the number of shaping : Matches ("\\d{11}"): The number is 11 bits, Matches ("\\d{6,11}") indicates that the number displayed is between 6-11.

This article is from the "Android Small Notes" blog, please be sure to keep this source http://dreamwing.blog.51cto.com/9872128/1610900

Android Small Notes

Related Article

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.