1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > android开发实验报告二 《Android 移动应用开发》实验报告-范本2(33页)-原创力文档...

android开发实验报告二 《Android 移动应用开发》实验报告-范本2(33页)-原创力文档...

时间:2021-08-05 20:23:12

相关推荐

android开发实验报告二 《Android 移动应用开发》实验报告-范本2(33页)-原创力文档...

实验1《Android活动的使用》

实验学时: 2

每组人数: 1

实验类型: 1 (1:基础性 2:综合性 3:设计性 4:研究性)

实验要求: 1 (1:必修 2:选修 3:其它)

实验类别: 2 (1:基础 2:专业基础 3:专业 4:其它)

一、实验目的

1. 让学生自己动手搭建开发环境

2. 熟悉android活动的使用

二、实验内容

1.搭建android开发环境

2.创建活动

3. 了解活动的生命周期

4. 使用活动传递数据

5. 了解活动的启动模式

三、实验要求:

1.能够上网,下载安装包

四、实验步骤

1.完成章节2.3的代码,具体要求:要求创建2个活动,并使用Intent在活动之间传递数据,传递的数据包括各种基本数据类型。(选做: 使用Intent在活动之间传递对象,提示: 使用Parcelable接口)

2.完成章节2.6提到的技巧改写章节2.3-2.5的代码,具体要求:使用一个菜单命令或者一个按钮退出整个应用程序,使用更好的方法来启动活动并传递数据.

五、实验结果

FirstActivity.java

package com.example.chen.myapplication;/** * Created by Apple on 16/3/31. */public class FirstActivity extends BaseActivity{ protected void onCreate(Bundle saveInstanceState){ super.onCreate(saveInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.first_layout); Button button1=(Button)findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(FirstActivity.this, "You clicked Button 1", Toast.LENGTH_SHORT).show(); //Intent intent=new Intent(FirstActivity.this,SecondActivity.class); /* Intent intent=new Intent("com.example.chen.ACTION_START"); intent.addCategory("com.example.activitytest.MY_CATEGORY"); */ /* Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("")); */ /* Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:10086")); */ String data = "Hello SecondActivity"; /*Intent intent = new Intent(FirstActivity.this,SecondActivity.class); intent.putExtra("extra_data",data); startActivity(intent); startActivityFo

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。