这是一个由哥开发的简单的不能再简单的短信发送器。

附上源码:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent"
  6. >
  7. <TextView
  8. android:text="@string/moble"
  9. android:layout_width="fill_parent"
  10. android:layout_height="wrap_content"
  11. />
  12. <EditText
  13. android:id="@+id/mobile"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content" />
  16. <TextView
  17. android:text="@string/content"
  18. android:layout_width="fill_parent"
  19. android:layout_height="wrap_content"
  20. />
  21. <EditText
  22. android:id="@+id/content"
  23. android:layout_width="fill_parent"
  24. android:layout_height="wrap_content"
  25. android:minLines="5" />
  26. <Button
  27. android:id="@+id/send"
  28. android:text="@string/send"
  29. android:layout_width="fill_parent"
  30. android:layout_height="wrap_content"
  31. ></Button>
  32. </LinearLayout>
  1. package gphone.cc.iSMS;
  2. import android.app.Activity;
  3. import android.os.Bundle;
  4. import android.telephony.SmsManager;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.EditText;
  8. import android.widget.Toast;
  9. import java.util.ArrayList;
  10. public class iSMSActivity extends Activity
  11. {
  12. EditText mobile=null;
  13. EditText content=null;
  14. Button sent=null;
  15. /** Called when the activity is first created. */
  16. @Override
  17. public void onCreate(Bundle savedInstanceState)
  18. {
  19. super.onCreate(savedInstanceState);
  20. setContentView(R.layout.main);
  21. sent=(Button)this.findViewById(R.id.send);
  22. sent.setOnClickListener(new Button.OnClickListener(){
  23. public void onClick(View view) {
  24. mobile=(EditText)findViewById(R.id.mobile);
  25. String mobileStr=mobile.getText().toString();
  26. content=(EditText)findViewById(R.id.content);
  27. String contentStr=content.getText().toString();
  28. SmsManager smsManager=SmsManager.getDefault();
  29. if(contentStr.length()>70){
  30. ArrayList<String> contents=smsManager.divideMessage(contentStr);
  31. for(String sms :contents){
  32. smsManager.sendTextMessage(mobileStr,null,contentStr,null,null);
  33. }
  34. }
  35. else{
  36. smsManager.sendTextMessage(mobileStr,null,contentStr,null,null);
  37. }
  38. Toast.makeText(iSMSActivity.this,R.string.msg,Toast.LENGTH_LONG).show();
  39. }
  40. });
  41. }
  42. }

androidminifast.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3. package="gphone.cc.iSMS"
  4. android:versionCode="2"
  5. android:versionName="1.1">
  6. <application android:label="@string/app_name" android:icon="@drawable/icon">
  7. <activity android:name="iSMSActivity"
  8. android:label="@string/app_name">
  9. <intent-filter>
  10. <action android:name="android.intent.action.MAIN" />
  11. <category android:name="android.intent.category.LAUNCHER" />
  12. </intent-filter>
  13. </activity>
  14. </application>
  15. <uses-sdk android:minSdkVersion="3"/>
  16. <uses-permission android:name="android.permission.SEND_SMS"/>
  17. </manifest>

string.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <string name="app_name">iSMS</string>
  4. <string name="moble">请电话输入号码</string>
  5. <string name="content">请输入短信内容</string>
  6. <string name="send">发送短信</string>
  7. <string name="msg">短信已发送</string>
  8. </resources>

下载地址:iSMS (rar改为apk即可)

转载于:https://www.cnblogs.com/AlexCheng/archive/2011/07/12/2119994.html

简易短信发送器iSMS相关推荐

  1. 实例教程二:短信发送器

    2012eoe移动开发者大会各嘉宾ppt汇总 http://www.eoeandroid.com/thread-206795-1-1.html OpenGL es 3D游戏火力篮球源码及PPT教程 h ...

  2. android学习笔记----短信发送器

    目录 模拟效果: 短信发送器: 短信发送器demo地址:https://github.com/liuchenyang0515/SmsSend 模拟效果: 我们初步想要的功能就是ListView显示一些 ...

  3. Android两个小Demo之电话拨号器和短信发送器

    两个简单的小案列 <1>电话拨号器 实现一个电话拨号器,我们分为简单的三步走: 1.在layout中写好布局 2.在MainActivity中写出对应的事件 3.在Manifest中配置好 ...

  4. Android实现电话拨号器和短信发送器

    电话拨号器 实现原理:用户输入电话号码,当点击拨打的时候,由监听对象捕获,监听对象通过文本控件获取到用户输入的电话号码,由于系统已经实现了电话拨号功能,所以我们只需要调用这个功能就可以了. 步骤: 1 ...

  5. Android实现简单短信发送器

    布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:too ...

  6. Android(java)学习笔记69:短信发送器

    1. 一般我们第一步都是先创建这个main.xml布局文件,这是良好的习惯: 1 <?xml version="1.0" encoding="utf-8" ...

  7. Android之制作短信发送器

    这次,我们做一个手机都有的功能--发短信,首先,既然是个小软件,新建项目的时候顺便图标也选为短信图标那个.首先我们还是先来实现页面布局,到activity_main.xml添加代码(我的默认是相对布局 ...

  8. Android项目——短信发送器

    因为应用要使用手机的短信服务,所以要在清单文件 AndroidManifest.xml 中添 加短信服务权限 : <?xml version="1.0" encoding=& ...

  9. 11_短信发送器_快速回复页面实现

    12321312 转载于:https://www.cnblogs.com/ZHONGZHENHUA/p/7136592.html

最新文章

  1. Cocoa/iPhone App/静态库 嵌入资源文件 rtb v0.1发布
  2. JAVA操作Excel表格
  3. apache camel_令人印象深刻的第一个Apache Camel版本
  4. 有哪些是你成为一名开发之后才知道的事情
  5. Linux 内核通知链和例程代码
  6. 记一次 Redis Cluster 宕机引发的事故
  7. 【转】SpringMVC整合websocket实现消息推送及触发
  8. 当当图书项目首页实现
  9. thinkphp使用dompdf导出pdf(html转pdf)
  10. 优动漫PAINT上色小技巧——套索填充功能教程
  11. 你一定要掌握的三条IT运维面试技巧
  12. 华三交换机snmp配置
  13. 传播正能量——《海南英才》阅读的读后感2200字
  14. 发现新大陆,超级好用的轻量级接口测试工具 Postcat
  15. IDEA快捷键以及和win10系统冲突
  16. 宏定义时对整数进行数据类型定义
  17. Centos7的最小化安装
  18. 洛谷P4233 射命丸文的笔记 分治NTT+竞赛图
  19. 人到中年才懂10个“潜”规则,过来人:除了生死,其他都是闲事
  20. OJ7826-KKT最少的操作次数

热门文章

  1. 【NOJ1325】【算法实验三】【分支限界法】特殊的二阶魔方
  2. 自动排产软件如何消除瓶颈问题
  3. “如何劝导孩子远离游戏?”
  4. Tech Summit 2018见闻:IT之家读者捕捉铺路集团董事长玄隐
  5. 区块链新思维迅雷同构多链架构实现百万TPS
  6. uniapp组件传值的方法(父传子,子传父,对象传值)案例
  7. 【云和恩墨大讲堂】李翔宇 - 轻轻揭开 b*tree 索引结构的神秘面纱
  8. 海外又曝出伪AI明星公司!人工智能是个巨大泡沫?
  9. 计算机图形学 第六章 图形变换
  10. java面向对象容许单独_Java笔试题附答案