20,182,322 2019-2020-1 "Object-oriented programming and data structures" Experiment 5 report

Course: "Programming and Data Structures"

Class: 1823

Name: Wang Meihao

Student ID: 20182322

Experiment Teacher: Wang Zhiqiang

Experiment Date: October 16, 2019

Compulsory / Elective: Compulsory

1. Experimental content

1.Android Stuidio the installation and testing:
reference "Java and Android Development Study Guide (Second Edition) (EPUBIT, Java for Android 2nd )" Twenty-four chapters:
Reference http://www.cnblogs.com/rocedu/p /6371315.html#SECANDROID, install Android Stuidio
complete Hello World, modify the content requirements res directory, the Hello World to show their student ID, a number of school students before and after their own student number, submit the code run shot and cloud code Git links, screenshots no student number to the point.
Learning Android Stuidio debug applications

2.Activity test
reference "Java and Android Development Study Guide (Second Edition) (EPUBIT, Java for Android 2nd )" Twenty-five chapters:
build the project, run the code related materials
created ThirdActivity, show their student number in the ThirdActivity , modify the code so that MainActivity start ThirdActivity

3.UI test
reference "Java and Android Development Study Guide (Second Edition) (EPUBIT, Java for Android 2nd )" Twenty-six chapters:
build the project, run materials relevant code
to modify the code so that the message Toast to show their student ID information

4. Test layout:
reference "Java and Android Development Study Guide (Second Edition) (EPUBIT, Java for Android 2nd )" Chapter XXVII:
build the project, run materials relevant code
to modify the layout of the interface to different pages and materials P290

5. Test Event Processing:
Reference "Java and Android Development Study Guide (Second Edition) (EPUBIT, Java for Android 2nd )" Twenty-eight chapters:
build the project, run materials relevant code
submit code run shot and cloud Git link code screenshot watermark to have student number, otherwise it will be penalized

2. Experimental procedure and results

Due to incompatible versions of the software I use Genymotion simulated android phone

  • Task One:
    Run:

  • Task Two:

1. Create a new name for the ThirdActivity

  • Android Studio automatically generates xml files of the Activity.
  • Add a text in ThirdActivity.xml, the jump has to represent the Activity.

2. Modify MainActivity
First, we will modify the xml file into a page only Button button, modify id information: android: id = "@ + id / btnStartAnotherAty", the Text text text message interface instead start another activity

3. Start another ThirdAcitivity
in MainActivity.java file, call the api to startAcitivity

 findViewById(R.id.btnStartAnotherAty).setOnCliListener(new View.OnClickListener() 
{    
    @Override   
    public void onClick(View v) {               
        startActivity(new Intent(MainActivity.this, ThirdActivity.class));

    }
    }); 

4. Run:

3. Task three:

  • In Toast project MainActivity.java, create and display a Toast, Startup mode after the click Button.

  • run:

4. Task four:

  • Set the background picture custom reference blog

link

  • Modify the interface
    First set the photo as the background, adding to the picture attribute, android: background = "@ mipmap / q"

  • run:

5. Task Five:

Experiment
1. Check the contents of the twenty-eight chapters and listeners online query of android
Android four kinds of ways to listen:

  • Implement monitor interface
  • Implement anonymous inner classes
  • Use an external class
  • Set up listeners directly in xml

2. Run Results:

3. Experimental problems encountered in the process and settlement process

  • Question 1: previously generated questions are very smooth big problem how to set ListView of each item is not listening to the information from the input until the time you need to enter the answer has some problems, because it is the first time to understand the development of Android, I do not know is, had kept the norm, to find information.
  • Question 1 solution: no results went online to find many books after the turn, finally found a ListView click event example code jump, I know that for a ListView in each item comes with a click event can be set listener, finally realized the effect I want.
  • Question 2: .Android Studio does not recognize virtual machine Genymotion in Andrews
  • Problem 2 Solution: Update Genymotion, uninstall the software, and re-download the Genymotion from the official website. Then you can use.
  • Question 3: Genymotion was forcibly closed by the remote host An existing connection
  • Question 3 Solution:

Other (perception, thinking, etc.)

  • Andrews experiments are concerned, is beyond the capacity within range, I spend a lot of time on the Internet to find information, ask other people to finish at the end of the experiment, which gave me a reminder that the next experiments to be done in advance.

  • Although this experiment is very difficult, but very practical learned a lot of useful things, I gain great.

Reference material

Guess you like

Origin www.cnblogs.com/wmh20182322/p/11723148.html