20165229 Experimental Report on Android program design

Source: Internet
Author: User

20165229 experiment Four "Android Program Design" experiment Report content:

Installation test for 1.Android Stuidio
2.Activity Test
3.UI Test
4. Layout test Reference "Java and Android Development Learning Guide (second Edition) (Epubit,java for Android 2nd)" Chapter 27th
5. Event Processing Test

Experimental requirements:

1. Download Android Studio in the Android studio Chinese community or Google developers China website;

2. Complete the experiment, write the experiment Report, the experiment report is published in the blog site blog, note that the experimental report is focused on the results of the operation, problems encountered (tool search, installation, use, program editing, commissioning, operation, etc.), solutions (empty methods such as "Check Network", "Ask classmates", "reading" 0 points) as well as analysis (what can be learned from it, what gains, lessons, etc.). The report can refer to Fan Fei long Teacher's guidance;

3. Plagiarism is strictly forbidden, and the results of the experiment of the perpetrator are zero, and other punitive measures are added;

Experimental steps

1. Install Android Stuidio (note the Environment configuration) (see Installation tutorial)
Complete Hello world and ask to modify the contents of the Res directory, and Hello world to show your number
Learn Android Stuidio Debug app

2.Activity Testing: Building a project, running a textbook-related code
Create thirdactivity, display your own number in thirdactivity, modify the code to let mainactivity start thirdactivity

3.UI Testing: Building a project, running a textbook-related code
Modify the code to let the toast message display its own learning number information

4. Layout test: Build the project, run the textbook related code
Modify the layout so that the P290 page interface is different from the textbook

5. Event Processing test: Build project, run textbook related code

6. In the lab report, Count your PSP (Personal software Process) time.

HelloWorld test:
    • You need to modify the text in the TextView in the layout file, and the code is as follows:
    • ```
- 运行结果![](https://images2018.cnblogs.com/blog/1296520/201805/1296520-20180520213934919-545384144.jpg)### Activity测试- 关键类ThirdActivity类代码如下:

public class Thirdactivity extends Activity {
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_third);
Intent Intent = Getintent ();
String message = Intent.getstringextra ("message");
((TextView) Findviewbyid (R.id.textview1)). SetText (message);
}

@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Getmenuinflater (). Inflate (R.menu.menu_main, menu);
return true;
}
}

-  实验![](https://images2018.cnblogs.com/blog/1296520/201805/1296520-20180520214001022-607641943.jpg)### UI测试-  修改代码让Toast消息中显示自己的学号信息,建议按照教材先大致理解BasicComponents项目,并尝试运行:

public class Mainactivity extends Activity {
Private Button m_btn;

@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
M_BTN = (Button) Findviewbyid (R.ID.ANALYSEBTN);
M_btn.setonclicklistener (ANALYSECALC);
}

Private Button.onclicklistener Analysecalc = new View.onclicklistener () {
@Override
public void OnClick (View arg0) {
Toast.maketext (Mainactivity.this, "Hello 20162330", Toast.length_short). Show ();
}
};
}

- 实验![](https://images2018.cnblogs.com/blog/1296520/201805/1296520-20180520214018371-1061991123.jpg)###  布局测试复制教材中的代码,修改布局文件的Text或者直接在Design界面中修改布局即可。修改Save按钮的位置代码如下:
-  运行结果### 事件处理测试运行教材中相关代码即可,注意changeColor方法调用了在setBackgroundColor方法中的多种背景颜色:

public void ChangeColor (view view) {
if (counter = = Colors.length) {
Counter = 0;
}
View.setbackgroundcolor (colors[counter++]);
}

预定义的颜色如下:

int counter = 0;
int[] Colors = {color.black, Color.Blue, Color.cyan, Color.dkgray, Color.gray,
Color.green, Color.ltgray, Color.magenta, Color.Red, Color.White, color.yellow};
```

  • Run results

20165229 Experimental Report on Android program design

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.