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.