< EditText Android:id = "@+id/txtnumber" android:layout_width= "Match_parent" android:layout_height= "80DP" android:inputtype= "Phone"> </EditText >
The above + indicates a new ID variable in R
Layout_width:match_parent is as wide as the parent node
HEIGHT:80DP is 80 units high (and pixels are not a thing, but for beginners it is just a good idea, the details refer to: http://blog.csdn.net/moruite/article/details/6028547)
InputType is very useful, decided to call up the keyboard can enter which things, in addition to phone and number, email, etc., more types, please refer to the graphical interface of the Textfields, or their own FQ to see this:/http Developer.android.com/reference/android/widget/textview.html#attr_android%3ainputtype and in the Code:/HTTP Developer.android.com/reference/android/text/inputtype.html
Then put a button, hang up the Click event, as follows:
1 Public classDialonclicklistenerImplementsOnclicklistener {2 3 @Override4 Public voidOnClick (View v) {5EditText txtnumber= (EditText) (mainactivity. This. Findviewbyid (R.id.txtnumber));6String strnumber=Txtnumber.gettext (). toString (); 7Strnumber= "Tel:" +Strnumber;8 9 TenIntent itt=NewIntent (); One itt.setaction (intent.action_call); A Itt.setdata (Uri.parse (Strnumber)); - startactivity (ITT); - the - } -}
It is important to note that the intent class represents an action that initiates an "intent".
In addition, to access the this pointer, you can access the main window pointer only through Mainactivity.this.
These are the core components and can be run.
【. NET old ape to Android Series "First lesson call program