java - what is the parameter passing to the OnClickListener()? -


i'm new java c family background. i'm unable dissect code. if me identifying inner classes , interfaces in block:

startbutton.setonclicklistener(new view.onclicklistener(){         public void onclick(view view)         {                                                 usrnameobj = (edittext)findviewbyid(r.id.et_usename);            usrpassobj = (edittext)findviewbyid(r.id.et_password);          string username = usrnameobj.gettext().tostring();          string password = usrpassobj.gettext().tostring();                   intent i=new intent(getapplicationcontext(),androidxmlresource.class);         i.putextra("entry",username.tostring() + password.tostring());         startactivityforresult(i,req_code);                }          }); 

i can imagine to:

startbutton.setonclicklistener(new view.onclicklistener());

but nothing between { }

onclicklistener interface defined view class. imagine this:

class view {     static interface onclicklistener     {         public void onclick(view v);     } } 

the thing between {} implementation of method onclick(view) of onclicklistener interface. thing between () starting new... called anonymous inner class. may find more clarifications here.

cheers!


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -