最简单的电话拨打程序
来源:互联网 发布:手游服务端源码 编辑:程序博客网 时间:2024/05/01 12:32
1.因为应用要使用手机的电话服务,所以要在清单文件AndroidManifest.xml中添加电话服务权限
<uses-permission android:name="android.permission.CALL_PHONE"/>
2.在界面中button的onClick事件的代码:
EditText text = (EditText)findViewById(R.id.mobile);
String mobile=text.getText().toString();//取得号码
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+mobile));
startActivity(intent);//这句与XXXX.this.startActivity(intent)等价
拓展知识:
1.其中//"android.intent.action.CALL"等价于Intent.ACTION_CALL
因为在android代码ACTION_CALL里面装的是"android.intent.action.CALL"这个字符串
常用Action动作:
ACTION_CALL activity Initiate a phone call.
ACTION_EDIT activity Display data for the user to edit.
ACTION_MAIN activity Start up as the initial activity of a task, with no data input and no returned output.
ACTION_SYNC activity Synchronize data on a server with data on the mobile device.
ACTION_BATTERY_LOW broadcast receiver A warning that the battery is low.
ACTION_HEADSET_PLUG broadcast receiver A headset has been plugged into the device, or unplugged from it.
ACTION_SCREEN_ON broadcast receiver The screen has been turned on.
ACTION_TIMEZONE_CHANGED broadcast receiver The setting for the time zone has changed.
2 Intent的构造函数:
1).Intent() //用到过
Create an empty intent.
2).Intent(Intent o)
Copy constructor.
3).Intent(String action)
Create an intent with a given action.
4).Intent(String action, Uri uri) //用到过
Create an intent with a given action and for a given data url.
5). Intent(Context packageContext, Class<?> cls) //用到过
Create an intent for a specific component.
6). Intent(String action, Uri uri, Context packageContext, Class<?> cls)
Create an intent for a specific component with a specified action and data.
3.static Uri parse(String uriString) 这个函数在android.net.Uri里面,是一个静态方法
Creates a Uri which parses the given encoded URI string.
- 最简单的电话拨打程序
- 简单拨打电话程序!!!
- 简单的电话拨打
- 拨打电话的程序
- 1.android最简单的拨打电话功能
- Android拨打电话和发短信的简单程序
- 拨打电话的简单实现
- 拨打电话的简单实现
- android 拨打电话的程序
- Android基础教程之----简单拨打电话程序!!!
- Android基础教程之----简单拨打电话程序!!!
- 拨打电话简单Demo
- android简单电话拨打
- 拨打电话小程序
- iOS程序拨打电话
- 微信小程序:拨打电话
- 拨打电话的礼仪
- 拨打电话的流程
- wordpress需要注意的问题
- Swarm程序分析StartHeatbugs程序
- 10秒内提交输入验证码
- c语言宏定义,可变参数的使用
- 保持带图标的桌面截图
- 最简单的电话拨打程序
- HDFS中的通信协议
- Google的十个核心技术
- Java性能的十一个用法
- ORACLE外连接小结~ http://blog.csdn.net/wh62592855/article/details/4852908
- ubuntu中eclipse中文乱码问题
- 第一个用GLSurfaceView画图形
- 使用MySQL数据库的23个注意事项
- 调用Android系统“应用程序信息(Application Info)”界面