Create Hello android

Source: Internet
Author: User

Develop the first Android Application-helloandroid in eclipse

Step 1: Select File> New> project from the eclipse menu bar and select androidproject under android to create a new androidproject.

The new androidproject dialog box is displayed. 1. projectname (project name) 2. application name (project name by default) 3. package name (package name) 4.min SDK version (the SDK version number is the version number you selected in build target by default)

Note: when you create an Android Application in eclipse for the first time, file-> new does not have androidproject. Therefore, you can only select androidproject under file-> New-> project to create androidproject. in the new androidproject dialog box, the build target item is very narrow. It is inconvenient to select the SDK ersion. In this case, you can select Windows> newwindow In the eclipse menu item when the first androidproject is created. in a new window, You Are Going To File> New to see if an androidproject is added above the original project, in this way, you can easily select the build target (the target device) when creating the androidproject project here.

Click Finish to create a new androidproject.

 

Here we create the androidproject step

File-> New-> Project expand Android, select androidproject and click Next

. Project name: helloandroid

. Application name: Hello, mr. Android

. Package name: COM. example. helloandroid

Create activity: helloandroid

Min SDK version: 3

Remove the check box before use default location and select your project path.

Select the desired SDK version in build target. Select android1.5 and click fininsh.

In SRC, The helloandroid. Java source code under the com. example. helloandroid package

 

package com.example.helloandroid;
 
import android.app.Activity;
import android.os.Bundle;
 
public class HelloAndroid extends Activity {  
  /** Called when the activity is first created. */    
@Override    public void onCreate(Bundle savedInstanceState) {     
   super.onCreate(savedInstanceState);   
   setContentView(R.layout.main);  
  }
}

Modify code

package com.example.helloAndroid;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;public class HelloAndroid extends Activity {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        //setContentView(R.layout.main);        TextView tv = new TextView(this);        tv.setText("hello Android nice to see you!");        setContentView(tv);    }}

Run the project

Run-run select Android Application

Start Android simulator AVD

Below is the change of AVD over time

Beginning

First

Second

Third


 

 

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.