EditText et = (EditText) Findviewbyid (r.id.callnum); String phone = Et.gettext (). toString (). Trim ();//Create intent intent Intent = new intent (); Intent.setaction (intent. Action_call); Intent.setdata (Uri.parse ("Tel:" +phone)); StartActivity (intent);
First type: this
The second type: New Onclicklistener implements the OnClick method
The Third Kind: Write a class inheritance Onclicklisener implement the OnClick method, passing the class instance object in the Setonclicklistener
Fourth: Set the OnClick property to the component in the layout, the value is arbitrary, then you must create a method with the same name in the context (typically activity) and pass the View object.
Official Note: If you specify android:onclick= "SayHello" to must declare a public void SayHello (View v) method of your context (Typi Cally your activity)
Android Phone Dialer (URI format) with four ways to set the Click event