android send sms

package com.lunzi.main;

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;
import android.widget.LinearLayout;

public class MainAct extends Activity {
Button button = null;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

button = new Button(this);
button.setText(
"click");
LinearLayout layout = new LinearLayout(this);
layout.addView(button);

setContentView(layout);

button.setOnClickListener(new MyListener());
}

class MyListener implements OnClickListener {

public void onClick(View v) {
Uri uri = Uri.parse(
"smsto://0800000123");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra(
"sms_body", "The SMS text");
startActivity(intent);

}

}
}
lunzi   2011-03-10 00:37:10 评论:0   阅读:431   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog