public void onItemClick(AdapterView<?> parent, View itemClicked, int position,long id) { 

Closed due to the fact that the essence of the issue is not clear to the participants of Kromster , user194374, Denis Bubnov , ermak0ff , aleksandr barakin 23 Dec '16 at 15:15 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • The question is incomprehensible. - post_zeew
  • No code is returned here and no variable does anything - they all just store the values - pavlofff

1 answer 1

Callback:

 void onItemClick(AdapterView<?> parent, View view, int position, long id) 

The following parameters are transmitted:

  • parent - the parent view for the view ;
  • view - an object of the class View - an element of the list that was clicked on;
  • position - view position in the adapter;
  • id - the id of the item.

UPD : @pavlofff :

It is worth adding that for data structures that do not have an ID (for example, an array or collection), the value of the argument id = position .

  • one
    It is worth adding that for data structures that do not have an ID (for example, an array or collection), the value of the argument id = position. - pavlofff
  • @pavlofff, Not really understood. Click to View processed here, how are arrays and collections related to this? - post_zeew
  • The adapter associates the View and the data; it is logical when clicking on an item to get a link to the data that it displays (position in an array or collection or ID in the database). For example, for SimpleCursorAdapter fourth argument will return the ID of the entry in the cursor on which the View filled, for the ArrayAdapter the position in the list will also be returned, as in the third argument. - pavlofff
  • This id is not the id that I clicked on, but the id in the database, for example. You should have been alerted by the fact that ID View is of type int , and not long - pavlofff
  • @pavlofff, By the way, yes, I noticed a long , but did not attach enough importance. Thank you, did not know this. Updated post. - post_zeew