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 ".