androidlistviewonitemclicklisteneronitemclick

What is the difference between "int" and "long" argument in onItemClick in Android


When we implement OnItemClickListener, we have to implement onItemClick method which is an abstract method in OnItemClickListener interface. In onItemClick method there are four arguments.

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    Toast.makeText(this, "Clicked on : " + arg2 + " long arg : " + arg3, 
                   Toast.LENGTH_LONG).show();
}

What I need to know is the difference between last two arguments (int arg2, long arg3). As you can see in my code, when I try to Toast it I get the same value for both arguments.


Solution

  • The given answers are so helpful. But the needed answer, I mean the exact answer I wanted was posted as a comment for the question by myself. But that wont increase my "accept level". So I thought to put the link as the answer for the question. Here is the link to the answer.