手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >Android使用Intent发送短信的实现方法
Android使用Intent发送短信的实现方法
摘要:本文实例讲述了Android使用Intent发送短信的实现方法。分享给大家供大家参考,具体如下:在一个Activity中使用Intent发送...

本文实例讲述了Android使用Intent发送短信的实现方法。分享给大家供大家参考,具体如下:

在一个Activity中使用Intent发送短信

package com.zhuguangwei; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class IntentActivity extends Activity { private Button myButton; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myButton = (Button) findViewById(R.id.myButton); myButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // 使用Intent发短信 Uri uri = Uri.parse("smsto:13800000000"); Intent intent = new Intent(Intent.ACTION_SENDTO,uri); intent.putExtra("sms_body", "The SMS text"); startActivity(intent); } }); } }

希望本文所述对大家Android程序设计有所帮助。

【Android使用Intent发送短信的实现方法】相关文章:

解析Android资源文件及他们的读取方法详解

Android应用开发中模拟按下HOME键的效果(实现代码)

Android中使用sax解析xml文件的方法

Android加载对话框同时异步执行实现方法

Android上网获取网络上的图片方法

基于Android中手势交互的实现方法

Android使用Pull解析器解析xml文件的实现代码

android中可以通过两种方式调用接口发送短信

android计时器,时间计算器的实现方法

Android Intent启动别的应用实现方法

精品推荐
分类导航