Android实验二:电话拨号和短信发送

这篇博客介绍了如何在Android应用中实现电话拨号和短信发送功能。首先,详细展示了activity_main.xml的界面布局,接着讲解了MainActivity的代码实现过程。需要注意的是,为了调用这些功能,必须在AndroidManifest.xml中添加相应的权限。尽管在高版本的Android系统中,直接调用的方法可能已失效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android实验:电话拨号和短信发送


实验四 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="电话号码: " 
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值