B0-52-16-7b-f6-b3 05 initial experience of Android Development (Experimental Project II)


Android is a free and open source operating system based on Linux. The application layer is mainly written in Java language. Because I learned some Java last semester, I have a certain foundation, but there are some differences between Android application development and Java GUI programming. The first is the construction of the development environment. At present, the mainstream include Eclipse loading ADT plug-ins and Android Studio development. In 2013, Google launched a new Android development environment - Android studio. Compared with Eclipse development, Android Studio development has many advantages, such as more perfect integration tools, more concise class wizard and automatic saving. Moreover, Google also announced that Android studio will replace Eclipse compilation environment, so I chose Android Studio development environment, However, Android studio also has high requirements for hardware configuration (if there is no solid-state drive, it may take more than three minutes to open an Android studio project).

1, Experimental purpose

1. Master the method of using Eclipse to develop Android application development program;,
2. Master the creation method of Android virtual device;
3. Understand the process structure of Android
4. Understand the method of creating Android program using command line;
5. Understand the Activity life cycle, Activity event callback and the use of onRestorelnstanceState() and onSavelnstanceSta functions. Master the method of using Eclipse to develop Android application development program;

2, Experimental requirements

1. Chapter 1 of the authoritative guide to Android programming.

2. Realize the initial experience of Android development.

3. Complete within one day.

4. Report requirements: network card + student number + experimental project.

1. Experimental code

The code is as follows (example):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" >
    android:text="@string/question_text" />
    android:orientation="horizontal" >
        android:text="@string/true_button" />
        android:layout_width ="wrap_content"
        android:text="@string/false_button" />


package com.aliyun.geoquiz;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private Button mTrueButton;
    private Button mFlaseButton;

    protected void onCreate(Bundle savedInstanceState) {

        mTrueButton = (Button) findViewById(R.id.true_button);
        mTrueButton.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v){
                //Does nothing yet,but soon!
        mFlaseButton = (Button) findViewById(R.id.flase_button);
        mFlaseButton.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v){
                //Does nothing yet,but soon!

<string name="app_name">GeoQuiz</string>
<string name="question_text">Canberra is the capital of Australia.</string>
<string name="true_button">True</string>
<string name="false_button">False</string>
    <string name="correct_toast">Correct!</string>
    <string name="incorrect_toast">Incorrect!</string>


2. Experimental equipment

1. Eclipse develops Android Applications
2. Android virtual machine (AVD)

3, Experimental steps

1. Screenshot of experimental steps

Create a new android project and select File and New Project

Select "Android empty activity project" and click Next.

After creating a GeoQuiz file, click Finish.

The interfaces displayed by Android are defined through configuration files in the form of xml. Of course, they can also be written entirely in code, but it is not as convenient as using xml configuration. Relatively complex interfaces need to be used in two ways.

The events, processing functions and business logic that need to be added to the interface components (common buttons, input boxes, etc.) configured in xml can be implemented in this Java class, which can be written according to business requirements.

The interface written through xml does not contain any functions. java code needs to be written to complete business functions, as shown in the figure. It is the most basic function implementation of Activity.

The core class for handling HTTP requests on the mobile terminal is org apache. http. client. Httpclient, through this core class, can build requests, send requests to the server and receive data returned by the server. The following is a code to request the latest version from the server. The comments explain the whole process.


Android application development may feel abstract at the beginning, but as long as you write more and Google more, you will find that its development is not difficult, but it is still difficult to really master some of its advanced features and the underlying implementation of API, and it still takes a long time to learn. As a beginner, I hope you can give me more advice. At the same time, I also hope you new people can work together and make progress together.

Tags: Android Studio

Posted by weknowtheworld on Thu, 05 May 2022 04:23:38 +0300