final ArrayAdapter adapter = new ArrayAdapter(...);
listView.setOnItemClickListener(new AdapterView.OnitemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
Word word = adapter.getItem(position);
}
});
I can't understand why the anonymous inner class calls the "adapter" object which should be declared "final" ? Is this a rule? Should i be remember that? I know the variable declared final will save its reference without changing. But in the example above, there is no change of reference, I just call a method on final object.