hey why do we create reference variables in the parameter list of a method? For eg,in android,suppose we have a button which has its onclick attribute="dosomething". So when this button is clicked,the "dosomething" method will be called.But this dosomething has a view parameter.I understand why we have a view parameter,because different buttons (views) may be calling the same function and we need to know what view is invoking it.But i dont understand how this dosomething function is called and who passes a parameter to it.What exactly is passed?An object of the view class?Please help its very confusing.From what I understand,we are creating a reference variable to a view object and the button that is invoking the dosomething function will be passed to this method and with the help of the reference variable v,we can do whatever we want,like get to know the id of the view object.I am new to android.
0 comments:
Post a Comment