java - Method's parameters -
i've started learning android development + beginner @ this.
i don't how/where, in case below, parameter of method in instantiated.
public class mainactivity extends activity { @override protected void oncreate(**bundle savedinstancestate**) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); radiogroup group1 = (radiogroup) findviewbyid(r.id.orientation); group1.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() { @override public void oncheckedchanged(**radiogroup group**, int checkedid) { switch (checkedid) { case r.id.radiobutton2: group.setorientation(linearlayout.horizontal); break; case r.id.radiobutton1: group.setorientation(linearlayout.vertical); break; } } }); }
thanks help
radiogroup.oncheckedchangelistener interface, , creating annonymouse inner class on your:
//take note @ key word new setoncheckedchangelistener(new radiogroup.oncheckedchangelistener{//overriden methods here});
that's how gets instantiated in code. hope helps.
update
reference observer pattern
custom action listener example
Comments
Post a Comment