当前位置: 首页 > news >正文

网站建设费用计入固定资产学习网站大全

网站建设费用计入固定资产,学习网站大全,网上做期末试卷的网站,自由策划网站建设1、发送短信涉及到权限#xff0c;我们需要把权限加上 2、当我们发送短信时#xff0c;不管发送是否成功#xff0c;接收方是否接收到#xff0c;系统都会发送广播 3、这时我们注册广播去接收一下就可以了 4、布局文件很简单#xff0c;里面就两个EditText和一个button 下… 1、发送短信涉及到权限我们需要把权限加上 2、当我们发送短信时不管发送是否成功接收方是否接收到系统都会发送广播 3、这时我们注册广播去接收一下就可以了 4、布局文件很简单里面就两个EditText和一个button 下面上代码里面有注释: 发送广播接收器:   package com.example.fanlei.cutnotedemo;import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.SmsManager; import android.widget.Toast;/*** 监听短信是否已经发送成功*/ public class MySmsSendReceiver extends BroadcastReceiver {Overridepublic void onReceive(Context context, Intent intent) {if (intent.getAction().equals(SMS_SEND)){switch(getResultCode()){case Activity.RESULT_OK:Toast.makeText(context,发送成功,Toast.LENGTH_SHORT).show();break;case SmsManager.RESULT_ERROR_GENERIC_FAILURE:Toast.makeText(context,发送失败,Toast.LENGTH_SHORT).show();break;case SmsManager.RESULT_ERROR_NO_SERVICE:break;case SmsManager.RESULT_ERROR_NULL_PDU:break;case SmsManager.RESULT_ERROR_RADIO_OFF:break;}}} } 接收方的广播 package com.example.fanlei.cutnotedemo;import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.widget.Toast;/*** 监听对方是否发已经接收到短信*/ public class MySmsDeliverReceiver extends BroadcastReceiver {Overridepublic void onReceive(Context context, Intent intent) {if (intent.getAction().equals(SMS_DELIVER)){switch(getResultCode()){case Activity.RESULT_OK:Toast.makeText(context,对方已接收,Toast.LENGTH_SHORT).show();break;case Activity.RESULT_CANCELED:break;}}} } 主函数 package com.example.fanlei.cutnotedemo;import android.app.PendingIntent; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.telephony.SmsManager; import android.view.View; import android.widget.EditText; import android.widget.Toast;import java.util.List;public class MainActivity extends ActionBarActivity {private EditText editText1,editText2;private MySmsSendReceiver mySmsSendReceiver; //发送短信的广播private MySmsDeliverReceiver mySmsDeliverReceiver;//对方是否已经接收的广播 Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);mySmsSendReceiver new MySmsSendReceiver();mySmsDeliverReceiver new MySmsDeliverReceiver();editText1 (EditText) findViewById(R.id.editText1);//手机号editText2 (EditText) findViewById(R.id.editText2);//内容//初始化启动意图Intent sendIntent new Intent();sendIntent.setAction(SMS_SEND);Intent deliverIntent new Intent();deliverIntent.setAction(SMS_DELIVER);//满足条件后执行Intentfinal PendingIntent send PendingIntent.getBroadcast(MainActivity.this,0 ,sendIntent,0);final PendingIntent deliver PendingIntent.getBroadcast(MainActivity.this,0,deliverIntent,0);//发送短信按钮findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {Overridepublic void onClick(View v) {String phoneNumber editText1.getText().toString();String content editText2.getText().toString();if (phoneNumber.equals()){Toast.makeText(MainActivity.this,手机号码为空,Toast.LENGTH_SHORT).show();}else {//获得短信的管理者SmsManager sm SmsManager.getDefault();//短信字数限制如果70则需要拆分短信发送if (content.length() 70){ListString contents sm.divideMessage(content);for (String sms : contents){sm.sendTextMessage(phoneNumber,null,sms,send,deliver);//发送短信}}else {sm.sendTextMessage(phoneNumber,null,content,send,deliver);//发送短信}}}});//注册广播registerReceiver(mySmsSendReceiver,new IntentFilter(SMS_SEND));registerReceiver(mySmsDeliverReceiver,new IntentFilter(SMS_DELIVER));} } 布局文件 RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:paddingLeftdimen/activity_horizontal_marginandroid:paddingRightdimen/activity_horizontal_marginandroid:paddingTopdimen/activity_vertical_marginandroid:paddingBottomdimen/activity_vertical_margintools:context.MainActivityEditTextandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:idid/editText1android:hint手机号android:inputTypephone/EditTextandroid:idid/editText2android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_belowid/editText1android:layout_alignParentLefttrueandroid:layout_alignParentStarttrueandroid:hint内容/Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:idid/buttonandroid:layout_centerVerticaltrueandroid:layout_centerHorizontaltrueandroid:text发送短信 //RelativeLayout 小伙伴们可以用10086进行测试 转载于:https://www.cnblogs.com/819158327fan/p/4932788.html
http://www.zqtcl.cn/news/267021/

相关文章:

  • 满城建设局网站我要买房网
  • 长沙百度提升排名南宁网站seo公司
  • 凡科网做网站怎样东莞寮步汽车城
  • 做百度网站费用多少基于html5的移动端网站开发
  • 专业做网站设计哪家好大型网站技术方案
  • 海外医疗兼职网站建设wordpress 最受欢迎主题
  • 网站改版方案案例入门级网页设计培训学员
  • 安徽优化网站运营平台
  • 小型企业网站设计教程面备案网站建设
  • 重庆业务外包网站建设办公室装修一般多少钱一个平方
  • 网站查询域名ip解析手机短视频网站的建设
  • 甘肃机械化建设工程有限公司网站微小店网站建设价格
  • 个人空间网站建设报告网络游戏交易平台
  • 深圳医疗网站建设中小企业网站功能
  • 汕头集团做网站方案建设网站要买空间吗
  • 宁波搭建网站专业展馆展厅设计公司深圳
  • 山东省建设工程电子信息网站广州开发区第一小学
  • 网站建设推广重要性河北高端网站建设
  • 网站的seo方案怎么做wordpress自动转内链
  • 番禺手机网站制作推广wordpress远程数据库
  • 企业网站seo外包 s深圳国内设计网站
  • 临海高端营销型网站建设地址免费网站alexa排名查询
  • 做企业网站的轻量级cms建设电子商务网站流程图
  • 淘宝网站设计分析国内在线免费服务器
  • wordpress网站文章加密网站建设 博采网络
  • 哪个网站做美食好一点网络运维个人工作总结
  • 做网红用哪个网站教人做策划的网站
  • 百度免费网站怎样建设wordpress模板目录结构
  • 长沙简单的网站建设公司wordpress+手机应用
  • 用spl做网站wordpress不用缓存