First Android Program-Hello android

Source: Internet
Author: User

Original article: http://www.anddev.org/hello_android_-_your_first_application-t31.html

Write the first Android program "Hello android"

What is this: this tutorial demonstrates how to create the simplest Android program.
What can be learned: Create an android project in eclipse, enter the code, and create a running configuration.

Difficulty: 0.5 of 5

Final effect:

Procedure:
1. First, create a new project and right-click the blank area on package-explorer.

2. Select "android Project"

3. Enter the following information:

4. This is the directory structure of the created Project (don't worry, most of them are resource files)

5. Locate and open "hello_android.java" and enter the following code:

6. Open the "open run dialog..." dialog box.

7. Set the settings as follows. Click Apply and then click Run.

8. The simulator is starting...

9. The main program is starting...

10. Congratulations! Your first program is running!


Complete code

Java:
Package org. anddev. Android. hello_android;

Import Android. App. activity;
Import Android. OS. Bundle;
Import Android. widget. textview;

Public class hello_android extends activity ...{
/*** // ** Called when the activity is first created .*/
@ Override
Public void oncreate (bundle icicle )...{
Super. oncreate (icicle );
// We want to view some very simple text, so we need a textview
Textview TV = new textview (this );
// Put some text to the newly created textview
TV. settext ("Hello Android-by: anddev.org" +
"This is soooo simple = D ");
// Tell our app to display the textview
This. setcontentview (TV );
}
}


 

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.