发布于 2017-03-27 09:43:30 | 175 次阅读 | 评论: 0 | 来源: 网友投递
Android移动端操作系统
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
本文实例讲述了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程序设计有所帮助。