会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
sfshine
博客园
首页
新随笔
联系
订阅
管理
发短信+拨电话--10010小助手
package com.su.phonebill; import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View; import android.widget.Button; import android.widget.Toast; public class PhoneBillActivity extends Activity { /** Called when the activity is first created. */ SmsManager sManager; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sManager = SmsManager.getDefault(); Button buttonCombo = (Button) findViewById(R.id.buttonCombo); Button buttonBalance = (Button) findViewById(R.id.buttonBalance); Button buttonPhone = (Button)findViewById(R.id.buttonPhone); buttonCombo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 创建一个PendingIntent对象 PendingIntent pi = PendingIntent.getActivity(PhoneBillActivity.this, 0, new Intent(), 0); // 发送短信 sManager.sendTextMessage("10010", null,"412", pi, null); // 提示短信发送完成 Toast.makeText(PhoneBillActivity.this, "短信发送完成", 8000).show(); } }); buttonBalance.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PendingIntent pi = PendingIntent.getActivity( PhoneBillActivity.this, 0, new Intent(), 0); sManager.sendTextMessage("10010", null, "ye", pi, null); Toast.makeText(PhoneBillActivity.this, "短信发送完成", 1000).show(); } }); buttonPhone.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); intent.setAction("android.intent.action.CALL"); intent.setData(Uri.parse("tel:10010")); startActivity(intent); } }); } }
posted @
2012-05-22 10:08
sfshine
阅读(
253
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告