I create an interface as follow :
// The OnClickListener interface :
public interface OnClickListener{
void onClick();
}
And a I create a Person Class :
// Class Person :
public class Person
{
String name;
OnClickListener onClicklisner;
Person(String name)
{
this.name = name;
this.onClickListener = new OnClickListener()
{
@Override
public void onClick() {
//I want to access to this.name attribute, but it doesn't work :
System.out.println(this.name);
}
};
}
}
In the onClick() method above, I want to access to this.name attribute, but it doesn't work.
How I can access that ?
Thank you very much.