I have code like this inside a method:
final TouchableSpan touchableSpan = new TouchableSpan() { @Override public void onClick(View widget) { this.setPressed(true); String extravar = touchableSpan.getMyVar(); }
On this line, String extravar = touchableSpan.getMyVar(); A warning appears that the touchableSpan variable touchableSpan not been initialized. Why there?
This warning came when I added the final modifier. I used to have variable is access from inner class, needs to be declared final .
source share