In Java when you need to access to an outer class member or variable from an inner class, you have to declare it final. See this question.
My question is: is this a good practice?
Particularly when I write code for android I often use solutions similar to this one:
final EditText textView = (EditText) setUrlDialog.findViewById(
R.id.dialog_text_set);
textView.setText(urlTw.getText());
alertDialogBulder.setPositiveButton(R.string.ok,
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
textView.getText()
//Do something with the text
}
});
Can this kind of solution cause performance problems? Are there any other reasons to avoid frequent use of this solution?