Reputation: 617
I am following a course on Udacity on android development. When I try something like this with auto complete:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
}
});
you can see that the primitive variable got the names i
, and j
. In this video, I believe android studio automatically gave the int variable the name "position". Do I need to enable this in android studio's settings, or is did the developer in the video just manually changed the name?
Upvotes: 0
Views: 239
Reputation: 35264
Much likely he changed it on his own. That's because the method of the AdapterView.Class
defines the OnItemClickListener interface
as follows:
public static interface OnItemClickListener {
void onItemClick(
android.widget.AdapterView<?> adapterView,
android.view.View view,
int i, // <-- position
long l);
}
As you can see, the position is named i
that's why the Auto-Completion names it this way.
Upvotes: 1