android 打电话 发短信
来源:互联网 发布:windows最小的系统 编辑:程序博客网 时间:2024/05/16 20:40
打电话
AndroidManifest.xml中添加电话服务权限:
<uses-permission android:name="android.permission.CALL_PHONE"/>
main.xml
android:inputType="number"
DialerAction.java
button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
EditText editText = (EditText)findViewById(R.id.mobile);
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+ editText.getText()));
DialerAction.this.startActivity(intent);
}
});
发信息
AndroidManifest.xml中添加短信服务权限:
<uses-permission android:name="android.permission.SEND_SMS"/>
main.xml
android:minLines="3"
SMSSender.java
String mobile = mobileView.getText().toString();
String content = contentView.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
PendingIntent sentIntent = PendingIntent.getBroadcast(SMSSender.this, 0, new Intent(), 0);
if(content.length()>70){//如果字数超过70,需拆分成多条短信发送
List<String> msgs = smsManager.divideMessage(content);
for(String msg : msgs){
smsManager.sendTextMessage(mobile, null, msg, sentIntent, null);
//最后二个参数为短信已发送的广播意图,最后一个参数为短信对方已收到短信的广播意图
}
}else{
smsManager.sendTextMessage(mobile, null, content, sentIntent, null);
}
Toast.makeText(SMSSender.this, "短信发送完成", Toast.LENGTH_LONG).show();
- android打电话,发短信
- android打电话,发短信
- android 打电话 发短信
- android打电话,发短信
- android 打电话发短信
- Android打电话&发短信
- android打电话,发短信
- android发短信打电话
- android打电话、发短信实现
- android 发短信与打电话
- android 打电话发短信转载
- android打电话、发短信实现
- android 打电话发短信实例
- Android打电话,发短信【JAVA】
- Android打电话&发短信
- Android实现发短信,打电话
- Android平台打电话、发短信、发Email
- Android 源码分析-打电话和发短信
- Bloom Filter概念和原理
- 文件锁使用原理及其方法
- 几个常用结构
- C++学习:list容器详解(一)
- C#正则表达式|C#快速开发工具
- android 打电话 发短信
- sql语句查询一个表的列数
- vmware下安装操作系统的一个提示
- 日本核辐射
- 算法学习记录
- 宽字符 单字符互转
- PMP知识点总结—制定进度计划的工具和技术
- 如何通过hg(水银)代码管理系统搭建完整的ecos源码平台
- SQL Server中部分未公开的存储过程