The meaning of the Onitemclicklistener listener four parameters in Android Adapterview

Source: Internet
Author: User

An understanding of the four parameters (ARG) of the Onitemclicklistener listener for the adapter interface in Android development:

Code: public void Onitemclick (adapterview<?> arg0, view view, int Position,long arg3) {}

If there is a ListView, the ListView contains the A,b,c,d 4 item.

If you order b this item. As follows:

(1) public void Onitemclick (adapterview<?> parent,

/* The parent is equivalent to a pointer to the ListView adapter, which can be used to get everything in the ListView */

(2) View view,

/* View is the handle to 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 */

(3) int position,

/* position is the position of B in the adapter (when the ListView is generated, the adapter makes the item one by one and then puts them in the order of the queue and puts them in the ListView, meaning that this b is position) */

(4) Long ID

/* ID is the position of the first line of B in the ListView (obviously line 2nd), and the value of position and ID is the same without Headerview, user added view, and Footerview. */

The meaning of the Onitemclicklistener listener four parameters in Android Adapterview

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.