android - Why is their Parameter of type View for an onClick Method -
.... android:onclick = "activity1"; .... public void activity1(view view) { ..... }
why parameter function of type view
you can set onclicklistener on view. means that listener not know kind of element set listener on.
since elements can set onclicklistener on extend view
, gives view because knows sure element view
.
you can detect element clicked, , can cast specific element if want.
Comments
Post a Comment