Android Development NOTE 1 (hello world), androidhello

Source: Internet
Author: User

Android Development NOTE 1 (hello world), androidhello

UI:

<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "helloworld"
Android: id = "@ + id/btnEnter"
Android: layout_marginTop = "96dp"
Android: layout_alignParentTop = "true"
Android: layout_centerHorizontal = "true"
Android: onClick = "MyClick"/> <! -- Define a click event -->

Code:
Import android. view. View; <! -- Import required -->
Public void MyClick (View v)
{
ShowDialog ("Hello world ");
}
/*
Display
*/
Private void ShowDialog (String str ){
New AlertDialog. Builder (MainActivity. this)
. SetMessage (str)
. Show ();
}

Development steps:

1. Download the SDK. You can download it from the official website. Currently, the latest version 5.0 is enough for learning.
2. Create an Andoroid program, MyAndroidDemo1, drag a button control to set the ID and text, then write a MyClick method in the Main program, set the button click event to select MyClick
3. Set the simulators, themes, boot programs, and Android versions.
4. Open Tools-Android-AVD Manager, create a downloaded skd version, and then start
5. Run the program to check the effect


Effect:

If there is any inappropriate place, contact me. Thank you.

 

Related Article

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.