Step by step, develop the first Android project as shown in the figure below and run the Android-Android development example tutorial 2 and the first android program.

Source: Internet
Author: User

Step by step, develop the first Android project as shown in the figure below and run the Android-Android development example tutorial 2 and the first android program.
1. generate an Android Application Project

1.run eclipse.exe

2. See

3. Enter the interface

4. Enter the application, project, and package name.

5. Select the workspace path created by the project;

6. Configure features such as icons and backgrounds

7. Select the page format of the Activity

8. Set the corresponding name

9. Generate a project

Ii. Project Introduction

1. You can drag the control using a tool on the interface. Graphical interface development environment.

2. Code Format of the interface Layout

3. MainActivity. java main program structure code and view binding

3. Code MainActivity. java

package com.example.helloworld;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        // Inflate the menu; this adds items to the action bar if it is present.        getMenuInflater().inflate(R.menu.main, menu);        return true;    }    }

4. Code activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    tools:context=".MainActivity" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/hello_world" /></RelativeLayout>

5. Code main. xml

<menu xmlns:android="http://schemas.android.com/apk/res/android" >    <item        android:id="@+id/action_settings"        android:orderInCategory="100"        android:showAsAction="never"        android:title="@string/action_settings"/></menu>
Iii. Project Operation

1. Run the project

2. Start the ADT simulator and the Android mobile phone simulation software. After running, the ADT is automatically started.

3. Running Interface

4. Click "Run configuration ".

 

 

 

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.