I am using IntelliJ IDEA for Android development. But there is one thing annoying me very much. When I use “Implement methods” feature it generates something like this:
new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
Parameter names are inconsistent, I expected to see something like this:
new OnItemSelectedListener() {
@Override
public void onItemSelected (AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}
How can I make IDEA generate correct parameter names?
Source code is required to get proper parameter names in code completion. Android SDK didn’t bundle sources until 4.0 platform version (API version 14), since then sources are available out of the box:
If you are using older platform version, see my answer for the workaround.