【. NET old ape to Android Series "First lesson call program

Source: Internet
Author: User

    < 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.