20155212 实验四 《Android程序设计》 实验报告

(一)Android Stuidio的安装测试

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十四章:

  • 安装 Android Stuidio
  • 完成Hello World, 要求修改res目录中的内容,Hello World后要显示自己的学号,提交代码运行截图和码云Git链接,截图没有学号要扣分
  • 学习Android Stuidio调试应用程序

实验(虚拟机——Genymotion平台三星S8安卓7.0系统)

  1. 截图

  2. app->src->main中有AndroidManifest.xml,这是一个清单文件。

  • 使用mainfest作为其根元素。package属性为应用程序指定了一个唯一的标识符
  • application元素描述了应用程序,包含了一个或多个activity元素,描述了App中的活动。主活动作app入口,name属性指定活动类。
  • @resourceType/name表示引用清单文件(以及项目中的其他XML文件)中的一个资源
  • 调试应用程序
    • 日志——android.util.Log类记录日志信息,方法:d(ebug) i(nfo) v(erbose) w(warning) e(rror) wtf(what a terrible failure) 、LogCat
    • 设置断点

(二)Activity测试

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十五章:

  • 构建项目,运行教材相关代码
  • 创建 ThirdActivity, 在ThirdActivity中显示自己的学号,修改代码让MainActivity启动ThirdActivity

实验(虚拟机——Genymotion平台三星S8安卓7.0系统)

  1. 截图

  2. 代码

  • MainActivity.java
package randolph1997.secondactivitydemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.TextView;; public class MainActivity extends Activity implements
OnTouchListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = (TextView)findViewById(R.id.testview1);
tv.setOnTouchListener(this);
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onTouch(View arg0, MotionEvent event) {
Intent intent = new Intent(this, ThirdActivity.class);
intent.putExtra("message","20155212江振思");
startActivity(intent);
return true;
}
}
  • ThirdActivity.java
package randolph1997.secondactivitydemo;

/**
* Created by Randolph1997 on 2017/5/19 0019.
*/ import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView; 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.testview1)).setText(message);
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_third,menu);
return true;
}
}
  • AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="randolph1997.secondactivitydemo"
android:versionCode="1"
android:versionName="1.0"> <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="@string/app_name">
</activity>
<activity
android:name=".ThirdActivity"
android:label="@string/app_name">
</activity>
</application> </manifest>

(三) UI测试

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十六章:

  • 构建项目,运行教材相关代码
  • 修改代码让Toast消息中显示自己的学号信息

实验(虚拟机——Genymotion平台三星S8安卓7.0系统)

  1. 截图

  2. MainActivity.java主要代码

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnshow1=(Button) findViewById(R.id.btn1);
btnshow1.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v){
Toast toast = Toast.makeText(MainActivity.this,"20155212江振思", Toast.LENGTH_LONG);
toast.show(); }
});
}

(四) 布局测试

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十七章:

  • 构建项目,运行教材相关代码
  • 修改布局让P290页的界面与教材不同

实验(物理机——华为荣耀8安卓7.0系统)

  1. 截图

  2. activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="2dp"
android:paddingRight="2dp"> <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/cancelButton"
android:layout_alignBottom="@+id/cancelButton"
android:layout_toStartOf="@+id/imageView3"
android:text="save" /> <Button
android:id="@+id/cancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cancel"
android:layout_marginTop="20dp"
android:layout_alignTop="@+id/imageView3"
android:layout_toEndOf="@+id/imageView3" /> <ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:padding="4dp"
android:src="@android:drawable/ic_btn_speak_now"
android:id="@+id/imageView3"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" /> <LinearLayout
android:id="@+id/filter_button_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
android:gravity="center|bottom"
android:orientation="horizontal"> <Button
android:id="@+id/filterButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Filter" /> <Button
android:id="@+id/shareButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Share" /> <Button
android:id="@+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Delete" />
</LinearLayout> <Chronometer
android:id="@+id/chronometer2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button"
android:layout_centerHorizontal="true"
android:layout_marginBottom="34dp" /> <Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Resume"
android:layout_alignBaseline="@+id/button4"
android:layout_alignBottom="@+id/button4"
android:layout_alignStart="@+id/button" /> <Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:text="Continue"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.Button"
android:layout_below="@+id/cancelButton"
android:layout_toEndOf="@+id/imageView3" /> <ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="23dp"
app:srcCompat="@android:drawable/btn_star_big_on"
android:layout_above="@+id/chronometer2"
android:layout_centerHorizontal="true" /> <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView3"
android:layout_centerHorizontal="true"
android:layout_marginTop="42dp"
android:text="20155212"
android:textAppearance="@style/TextAppearance.AppCompat.Display3" /> </RelativeLayout>

(五) 事件处理测试

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十八章:

  • 构建项目,运行教材相关代码
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分

实验(物理机——华为荣耀8安卓7.0系统)

  1. 截图

(六) 项目码云链接

(七) PSP(Personal Software Process)时间

步骤 耗时 百分比
需求分析 30min 18.75%
设计 30min 18.75%
代码实现 60min 37.50%
测试 20min 12.50%
分析总结 20min 12.50%

20155212 实验四 《Android程序设计》 实验报告的更多相关文章

  1. 实验四 Android程序设计 实验报告

    实验四 Android程序设计 实验报告 目录 代码托管地址 Android程序设计-1 Android程序设计-2 Android程序设计-3 Android程序设计-4 Android程序设计-5 ...

  2. 20155326 实验四 Android程序设计实验报告

    20155326 实验四 Android程序设计实验报告 实验内容 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android.组件.布局管理器的使用: 3. ...

  3. 20165230 《Java程序设计》实验四 Android程序设计实验报告

    20165230 <Java程序设计>实验四 Android程序设计实验报告 一.实验报告封面 课程:Java程序设计 班级:1652班 姓名:田坤烨 学号:20165230 成绩: 指导 ...

  4. 20162325金立清 实验四 Android程序设计 实验报告

    实验四 Android程序设计 实验报告 代码托管地址 码云链接 实验内容 安装使用Android Stuidio Activity测试 UI测试 布局测试 事件处理测试 Android程序设计-1 ...

  5. 实验四 Android程序设计 实验报告 20162305李昱兴

    实验四 Android程序设计 实验报告 20162305李昱兴 一.Android Studio的安装测试 1.有关该软件 Android Studio,是基于Itellij IDEA的一款流行的I ...

  6. 20172302《程序设计与数据结构》实验四Android程序设计实验报告

    课程:<程序设计与数据结构> 班级: 1723 姓名: 侯泽洋 学号:20172302 实验教师:王志强老师 实验日期:2018年5月30日 必修/选修: 必修 1.实验内容 (1)And ...

  7. 20155328 实验四 Android程序设计 实验报告

    20155328 实验四 Android程序设计 第24章 初识Android 提交点1:完成HelloWorld并显示自己的学号 安装Android Studio后,创建了属于自己的Project( ...

  8. 2016-2017-2 20155312 实验四Android程序设计实验报告

    遇到的问题及解决过程 「问题1」Android Studio-R文件出错 解决:参考Android Studio-R文件错误的解决办法步骤如下: 第一步:检查xml文件,R文件错误通常是由于我们的xm ...

  9. 第十四周实验报告:实验四 Android程序设计

    20162317袁逸灏 第十四周实验报告:实验四 Android程序设计 实验内容 Android Studio 实验要求 学会使用Android Studio 学习 活动 以及相关知识内容 学习 U ...

  10. 实验四 Android程序设计

    20155224 实验四 Android程序设计 实验报告 实验报告封面: 课程:Java程序设计 班级:1652班 姓名:王高源 学号:20165225 指导教师:娄嘉鹏 实验日期:2018年5月1 ...

随机推荐

  1. Legendary Items-微软实习生笔试第一题

    题目如下: 这道题难点不仅在于正确理解题意,判断递归条件,更在于用数学方法推出解决公式.因为N最大为1百万,而内存只有256MB, 所以暴力递归肯定会超时,超空间. 不过,我才疏学浅,又没有大量时间去 ...

  2. Python之路-计算机基础

    一·计算机的组成 一套完整的计算机系统分为:计算机硬件,操作系统,软件.   硬件系统:运算器,控制器和存储器 ,输入设备,输出设备. 1.运算器:负责算数运算和逻辑运算,与控制器一起组成CPU. 2 ...

  3. Java--JDBC连接数据库

         我们知道Java中的jdbc是用来连接应用程序和数据系统的,本篇文章主要就来看看关于JDBC的实现和使用细节.主要包含以下几点内容: JDBC的基本知识(数据驱动程序) JDBC的连接配置 ...

  4. 网站建设常用JQuery插件整理

    1.jQuery.lazyload 作用:延迟加载网站图片,常用于电商网站.图片展示网站,对于提高网站打开速度比较有效. 2.Owl Carousel 作用:图片滚动特效.响应式传送带插件,特点是支持 ...

  5. Android 开发之错误整理 [2014-04-28 09:22:28 - XXXX] Unable to resolve target 'android-18'

    在开发的时候难免会导入项目,那么怎么经常会遇到这个错误: [2014-04-28 09:22:28 - XXXX] Unable to resolve target 'android-18' targ ...

  6. linux 常用命令之一

    ---恢复内容开始--- Applications->Accessories->Terminal(终端) 终端运行起来会启动一个Shell为我们服务 1.提示符是"#" ...

  7. ASP.NET自定义处理程序

    要创建自定义处理程序,可以创建一个实现IHttpHandler接口的类. 该类有两个重要的参数:IsResuable属性和ProcessRequest方法.如果处理程序实例可以在不同的请求中重用,Is ...

  8. 详解Executor框架

    在Java中,使用线程来异步执行任务.Java线程的创建与销毁需要一定的开销,如果我们为每一个任务创建一个新线程来执行,这些线程的创建与销毁将消耗大量的计算资源.同时,为每一个任务创建一个新线程来执行 ...

  9. 多个git账号的SSH配置

    一般使用git都只需要维持一个默认的git账户就可以打天下了. 但如果自己确实需要多个git账号的需求的话,就有必要配置多个ssh key了. 首先为生成多个ssh key ssh-keygen -t ...

  10. Android 性能优化——之图片的优化

    Android 性能优化——之图片的优化 在Android性能优化中,我们会发现占内存最大的和对性能影响最大的往往是图片资源,其次是控件资源.相对来说,其他的资源的影响会小一点.这里我就先对图片资源的 ...