PerformClick Using code is the click event of the active call control (to touch the control)-----------------------------------------boolean Android.view.View.performClick ()
Call this view's Onclicklistener, if it is defined.
- Returns:
- True There was a assigned onclicklistener that were called, false otherwise is returned.
---------------------------------------------@Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);Setcontentview (r.layout.activity_my);btn1 = (Button) Findviewbyid (r.id.button1);TV1 = (TextView) Findviewbyid (r.id.textview1); Btn1.performclick (); Btn1.setonclicklistener (New Onclicklistener () {@OverridePublic void OnClick (View v) {Tv1.settext ("has been clicked");}});
}
write the above, TV1 the text is the default text, only need setonclicklistener written declaration PerformClick, directly perform the talent show "it has been clicked"
Android PerformClick use