android 短信发送器(SmsManager)
来源:互联网 发布:白金数据结局是什么 编辑:程序博客网 时间:2024/06/05 11:47
android的短信发送器主要是采用SmsManager来实现的。
package com.example.activity;import java.util.ArrayList;import android.app.Activity;import android.os.Bundle;import android.telephony.SmsManager;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.EditText;import android.widget.Toast;public class SendSms extends Activity {private EditText numberText;private EditText contentText;private Button send;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.sms);numberText=(EditText)findViewById(R.id.number);contentText=(EditText)findViewById(R.id.content);send=(Button)findViewById(R.id.send);send.setOnClickListener(new ButtonClickListener());}public final class ButtonClickListener implements OnClickListener{@Overridepublic void onClick(View v) {String number=numberText.getText().toString();String content=contentText.getText().toString();SmsManager manager=SmsManager.getDefault();ArrayList<String> texts=manager.divideMessage(content);for(String text:texts){manager.sendTextMessage(number, null, text, null, null);}Toast.makeText(SendSms.this, "发送成功", Toast.LENGTH_SHORT).show();}}}
相对于的界面:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="发送号码" android:textSize="18dip" /><EditText android:id="@+id/number" android:layout_width="fill_parent" android:layout_height="wrap_content" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="发送内容" android:textSize="18dip" /><EditText android:id="@+id/content" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minLines="3" /><Button android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="发送" /></LinearLayout>
- android 短信发送器(SmsManager)
- Android:利用SmsManager发送短信
- Android入门:利用SmsManager发送短信
- Android入门:利用SmsManager发送短信
- Android入门:利用SmsManager发送短信
- Android 使用SmsManager发送短信
- SmsManager类发送短信
- 利用SmsManager发送短信
- android短信管理器-SmsManager
- Android SmsManager 短信群发
- Android SmsManager 发送超长短信 接收不完整
- Android通过SmsManager发送短信(附源码)
- Android开发案例发送短信调用SmsManager 03
- Android SmsManager(短信管理器),发送短信息
- Android发送短信 SmsManager的使用 返回发送结果 发送超长短信
- 发送短信之分割短信 SMSManager
- Android短信之SmsManager类
- android短信管理器(SmsManager)实例
- Android开发 实现连续按两次返回键则退出程序
- 常量指针和指针常量
- 好的图像处理网站
- android 中ids.xml资源的使用
- VC++中结构体的定义及使用
- android 短信发送器(SmsManager)
- 关于构造函数
- 使用Unity3D开发项目的一点经验
- Asp.net自定义控件事件
- ORA-28547: 连接服务器失败, 可能是 Oracle Net 管理错误(一种情况,去掉 (PROGRAM = extproc) )
- 理解虚基类、虚函数与纯虚函数的概念
- Lua学习笔记(六)
- linux内核文件翻译 田雨 计科1002 1012300206
- Asp.net自定义控件事件