Android in the ListView click Listener Onitemclick Four parameters meaning

Source: Internet
Author: User

public void Onitemclick (adapterview<?> arg0, view view, int position,

Long Arg3)

X, y two listview,x there are 1,2,3,4 in these 4 item,y have a,b,c,d these 4 item.

If you order b this item. As follows:

public void Onitemclick (adapterview<?> parent,//parent is equivalent to a pointer to the ListView y adapter, which can be used to get everything that's in Y, and then it's plain to tell you that you ordered Is Y, not X--,

View view,//view is the handle of the view that you point to B item, that is, you can use this view to get the ID of the control in B and then manipulate the control

int position,//position is the position of B in the Y adapter (when the ListView is generated, the adapter makes the item one after the other, and then puts them in order, and puts them in the ListView, meaning that this B is the number position)

Long ID//ID is the position of the first line of B in ListView Y (obviously the 2nd line), most of the time the value of position and ID is the same, if necessary, you can add a log to the position and ID all out in Logcat, After watching, my heart was steadfast.

Android in the ListView click Listener Onitemclick Four parameters meaning

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.