what is "this" in setOnClickListenner in Android -
I am new to Android and I know that this is a very common question. I tried to find the answer, but did not satisfy my curiosity. It is believed that in order to define the audience for a button in Android I have the code below. I am still confused about it. I know "this" refers to the current example but in this case, what does "this" represent? Does this example indicate btnSave or other objects? Why this argument can change (New OnClickListener ()) It has been assumed that I have two identical buttons. How do I know the on-click method that is clicked on ??? Can anyone explain the purpose of "this" in a wider state?
find button BTNS service = (button) VVBIID (RBTN service); BtnSave.setOnClickListener (this); Click Public Zero (see V) {// do something here}
here , refers to the
context of the current object, the container in which btnSave
in this code was the purpose that the container be on the click
button The listener will listen to the process by listening to the method such as onClick
and take action.
Comments
Post a Comment