Pero Pero - 2 months ago 11
Java Question

Variable needs to be declared from inner class

In android studio I have a problem:

variable 'button' is accessed from withing inner class, needs to be declared final.


How do I fix this ?

Answer

Just type final before your variable.
For example:

final button;

This should do the job.