android - How do I refer to an Interface in an inner method in Java -


i still newbie in java programming , learnt how create own listener , stuck @ following. have class implements interface created in class. code below.

public class mainactivity extends activity  implements asyncclasssocket.listener{    asyncclasssocket thesocketclass = new asyncclasssocket(); @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);       thesocketclass.registerlistener(this);      //more codes     } }  @override public void onreplyfromserver(boolean state) {     //codes } 

the above codes working fine. however, when put codes inner method below

showprogressdialog.setonclicklistener(new view.onclicklistener() {                   @override         public void onclick(view v) {             thesocketclass = new asyncclasssocket();             thesocketclass.registerlistener(this); <---- problem             showprogressdialog();                thesocketclass.execute();                        }     });      }  

i can no longer refer interface because refer view.onclicklistener(). question how refer interface in inner method?

simply use mainactivity.this main activity reference.