实验四 Android程序间通信(2课时)
一、实验目的
1、学习android程序之间的通信方法。
二、实验内容
1、编写程序,实现短信发送的功能,要求程序提供用户输入电话号码和短信内容的界面。
2、编写程序,实现电话拨号的功能,要求程序提供用户输入电话号码界面。
三、实验步骤
1、建立一个android工程,修改main.xml文件并编写程序代码,设计一个实现短信发送的功能的程序,要求程序提供用户输入电话号码和短信内容的界面。
2、建立一个android工程,修改main.xml文件及清单文件,并编写程序代码,设计一个电话拨号功能的程序,要求程序提供用户输入电话号码的界面。
四、考核标准:
1、完成全部题目,设计合理,结果正确;评定为A。
2、完成部分题目,设计比较合理,结果正确;根据实际情况评定为B或C。
3、未独立完成实验要求;评定为D。
1.界面布局
activity_main.xml文件
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="410dp"
android:layout_height="205dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="4dp"
tools:layout_editor_absoluteY="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="电话号码: "