当前位置:  编程技术>移动开发
本页文章导读:
    ▪Rexsee API引见:SMSSender短信发送        Rexsee API介绍:SMSSender短信发送   rexseeSMSSender扩展,实现短信发送与事件回调。   【函数】 void send(String phoneNumber, String message) 【说明】 发送短信。 【返回】 无 【参数】 phoneNumber:目标手.........
    ▪ Rexsee API引见:CallLog通话记录        Rexsee API介绍:CallLog通话记录   rexseeCallLog对象,实现自定义数量的最近通话记录,自定义查询最近通话,读取记录数据库表的URI地址。。   【函数】 JsonObjectArray get(int number) 【说明】 获取.........
    ▪ checkbox 默许选中       checkbox 默认选中 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <tr> <td width="15%" align="right" height="30">办理状态:</td> <td width="71%" colspan="5"> <input type="checkbox" name=".........

[1]Rexsee API引见:SMSSender短信发送
    来源: 互联网  发布时间: 2014-02-18
Rexsee API介绍:SMSSender短信发送

 

rexseeSMSSender扩展,实现短信发送与事件回调。

 

【函数】 void send(String phoneNumber, String message)

【说明】 发送短信。

【返回】 无

【参数】

phoneNumber:目标手机号码。

message:短信内容。

 

【函数】 void send(String id, String phoneNumber, String message)

【说明】 发送短信并回调事件。

【返回】 无

【参数】

id:任意的ID,在事件onSmsSent和onSmsDelivered中标识该条短信,如果为空,则onSmsSent和onSmsDelivered不会被调用。

phoneNumber:目标手机号码。

message:短信内容。

 

【事件】 void onSmsSent(String id, String result)

【说明】 调用send()函数后,如果id不为空,当短信发送完毕时触发。

【参数】

id:短信的自定义id。

result:发送结果,如果成功返回"OK",否则返回错误信息。

 

 

【事件】 void onSmsDelivered(String id, String pdu)

【说明】 调用send()函数后,如果id不为空,当短信发送到接收方时触发,注意,触发该事件可能需要较长时间,取决于网络状况。

【参数】

id:短信的自定义id。

pdu:发送报告。

 

详细java源码:rexseeSMSSender.java

 

/* 
* Copyright (C) 2011 The Rexsee Open Source Project 
* 
* Licensed under the Rexsee License, Version 1.0 (the "License"); 
* you may not use this file except in compliance with the License. 
* You may obtain a copy of the License at 
* 
*      http://www.rexsee.com/CN/legal/license.html 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the License. 
*/ 
 
package rexsee.communication;  
 
import java.util.ArrayList;  
 
import rexsee.core.browser.Browser;  
import rexsee.core.browser.clazz.JavascriptInterface;  
import android.app.Activity;  
import android.app.PendingIntent;  
import android.content.BroadcastReceiver;  
import android.content.Context;  
import android.content.Intent;  
import android.content.IntentFilter;  
import android.telephony.SmsManager;  
 
public class RexseeSMSSender implements JavascriptInterface {  
 
       private static final String INTERFACE_NAME = "SMSSender";  
       @Override  
       public String getInterfaceName() {  
               return mBrowser.application.resources.prefix + INTERFACE_NAME;  
       }  
       @Override  
       public JavascriptInterface getInheritInterface(Browser childBrowser) {  
               return this;  
       }  
       @Override  
       public JavascriptInterface getNewInterface(Browser childBrowser) {  
               return new RexseeSMSSender(childBrowser);  
       }  
 
       public static final String EXTRA_SMS_ID = "smsID";  
       public static final String EXTRA_SMS_PART = "smsPart";  
       public static final String EXTRA_SMS_PART_TOTAL = "smsPartTotal";  
 
       public static final String ACTION_SMS_SENT = "SENT_SMS_ACTION";  
       public static final String ACTION_SMS_DELIVERED = "DELIVERED_SMS_ACTION";  
 
       public static final String EVENT_ONSMSSENT = "onSmsSent";  
       public static final String EVENT_ONSMSDELIVERED = "onSmsDelivered";  
 
       private final Context mContext;  
       private final Browser mBrowser;  
 
       private String mId = "";  
       private int mTotalSize = 0;  
       private int mSentSize = 0;  
 
       private String getResultString(int resultCode) {  
               switch (resultCode) {  
                       case Activity.RESULT_OK :  
                               return "OK";  
                       case SmsManager.RESULT_ERROR_GENERIC_FAILURE :  
                               return "RESULT_ERROR_GENERIC_FAILURE";  
                       case SmsManager.RESULT_ERROR_NO_SERVICE :  
                               return "RESULT_ERROR_NO_SERVICE";  
                       case SmsManager.RESULT_ERROR_NULL_PDU :  
                               return "RESULT_ERROR_NULL_PDU";  
                       case SmsManager.RESULT_ERROR_RADIO_OFF :  
                               return "RESULT_ERROR_RADIO_OFF";  
                       default :  
                               return "OK";  
               }  
       }  
       private final BroadcastReceiver mSentReceiver = new BroadcastReceiver() {  
               @Override  
               public void onReceive(Context context, Intent intent) {  
                       mSentSize++;  
                       if (mSentSize == mTotalSize) {  
                               context.unregisterReceiver(this);  
                               mBrowser.eventList.run(EVENT_ONSMSSENT, new String[]{mId, getResultString(getResultCode())});  
                       }  
               }  
       };  
       private final BroadcastReceiver mDeliveredReceiver = new BroadcastReceiver() {  
               @Override  
               public void onReceive(Context context, Intent intent) {  
                       context.unregisterReceiver(this);  
                       mBrowser.eventList.run(EVENT_ONSMSDELIVERED, new String[]{mId, intent.getStringExtra("pdu")});  
               }  
       };  
 
       public RexseeSMSSender(Browser browser) {  
               mBrowser = browser;  
               mContext = browser.getContext();  
               browser.eventList.add(EVENT_ONSMSSENT);  
               browser.eventList.add(EVENT_ONSMSDELIVERED);  
       }  
 
       //JavaScript Interface  
       public void send(String phoneNumber, String message) {  
               send(null, phoneNumber, message);  
       }  
       public void send(String id, String phoneNumber, String message) {  
 
               SmsManager sms = SmsManager.getDefault();  
               ArrayList<String> msgs = sms.divideMessage(message);  
               mTotalSize = msgs.size();  
               mSentSize = 0;  
               mId = (id != null && !id.trim().equals("")) ? id : null;  
 
               try {  
                       mContext.unregisterReceiver(mSentReceiver);  
                       mContext.unregisterReceiver(mDeliveredReceiver);  
               } catch (Exception e) {  
               }  
 
               ArrayList<PendingIntent> sentIntents = null;  
               ArrayList<PendingIntent> deliveryIntents = null;  
               if (mId != null) {  
                       sentIntents = new ArrayList<PendingIntent>();  
                       deliveryIntents = new ArrayList<PendingIntent>();  
                       PendingIntent deliverPI = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_SMS_DELIVERED), 0);  
                       for (int i = 0; i < mTotalSize; i++) {  
                               PendingIntent sentPI = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_SMS_SENT + "_" + i), 0);  
                               sentIntents.add(sentPI);  
                               mContext.registerReceiver(mSentReceiver, new IntentFilter(ACTION_SMS_SENT + "_" + i));  
                               deliveryIntents.add(deliverPI);  
                       }  
                       mContext.registerReceiver(mDeliveredReceiver, new IntentFilter(ACTION_SMS_DELIVERED));  
               }  
               sms.sendMultipartTextMessage(phoneNumber, null, msgs, sentIntents, deliveryIntents);  
 
       }  
 
}

    
[2] Rexsee API引见:CallLog通话记录
    来源: 互联网  发布时间: 2014-02-18
Rexsee API介绍:CallLog通话记录

 

rexseeCallLog对象,实现自定义数量的最近通话记录,自定义查询最近通话,读取记录数据库表的URI地址。。

 

【函数】 JsonObjectArray get(int number)

【说明】 获取指定数量的最近通话。

【返回】 Json对象数组,使用eval('('+json+')')转换为JavaScript对象数组。

【参数】 number:要获取的最近通话的数量。

【示例】

 

Html代码 
  • alert(rexseeCallLog.get(10));  
  •  

    【函数】 JsonObjectArray get(String type, int number)

    【说明】 获取值类型、指定数量的最近通话。

    【返回】 Json对象数组,使用eval('('+json+')')转换为JavaScript对象数组。

    【参数】 type:类型,"INCOMING"(数据库中为1)、"OUTGOING"(数据库中为2)或"MISSED"(数据库中为3)。

    number:要获取的最近通话的数量。

    【示例】

     

    Html代码 
  • alert(rexseeCallLog.get('INCOMING',10));  
  • alert(rexseeCallLog.get('OUTGOING',10));  
  • alert(rexseeCallLog.get('MISSED',10));  
  •  

    【函数】 JsonArray getColumns()

    【说明】 获取通话记录数据表所有字段。

    【返回】 Json数组,使用eval('('+json+')')转换为JavaScript数组,注意,为了提高效率,调用get()或getData()时并不会返回其中所有字段。

    【参数】 无

    【示例】

     

    Html代码 
  • alert(rexseeCallLog.getColumns());  
  •  

    【函数】 JsonObjectArray getData(String selection, int number)

    【说明】 获取自定义查询条件的最近通话。

    【返回】 Json对象数组,使用eval('('+json+')')转换为JavaScript对象数组。

    【参数】 selection:自定义查询条件,相当于SQL语句中的WHERE字句(不含单词WHERE)。

    number:要获取的最近通话的数量。

    【示例】

     

    Html代码 
  • alert(rexseeCallLog.getData('duration<10',10));  
  •  

    RexseeCallLog.java源码:

     

    /* 
    * Copyright (C) 2011 The Rexsee Open Source Project 
    * 
    * Licensed under the Rexsee License, Version 1.0 (the "License"); 
    * you may not use this file except in compliance with the License. 
    * You may obtain a copy of the License at 
    * 
    *      http://www.rexsee.com/CN/legal/license.html 
    * 
    * Unless required by applicable law or agreed to in writing, software 
    * distributed under the License is distributed on an "AS IS" BASIS, 
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    * See the License for the specific language governing permissions and 
    * limitations under the License. 
    */ 
     
    package rexsee.content;  
     
    import rexsee.core.browser.JavascriptInterface;  
    import rexsee.core.browser.RexseeBrowser;  
    import rexsee.core.browser.UrlListener;  
    import rexsee.core.lang.RexseeLanguage;  
    import rexsee.core.utilities.RexseeUtilities;  
    import android.content.ContentResolver;  
    import android.content.Context;  
    import android.database.Cursor;  
    import android.provider.CallLog.Calls;  
     
    public class RexseeCallLog implements JavascriptInterface {  
     
           private static final String INTERFACE_NAME = "CallLog";  
           @Override  
           public String getInterfaceName() {  
                   return mBrowser.application.resources.prefix + INTERFACE_NAME;  
           }  
           @Override  
           public JavascriptInterface getInheritInterface(RexseeBrowser childBrowser) {  
                   return this;  
           }  
           @Override  
           public JavascriptInterface getNewInterface(RexseeBrowser childBrowser) {  
                   return new RexseeCallLog(childBrowser);  
           }  
     
           private static final String[] CALLS_COLUMNS = new String[]{  
                           Calls.NUMBER, //0  
                           Calls.TYPE, //1  
                           Calls.DATE, //2  
                           Calls.DURATION //3  
           };  
     
           private final Context mContext;  
           private final RexseeBrowser mBrowser;  
     
           public RexseeCallLog(RexseeBrowser browser) {  
                   mBrowser = browser;  
                   mContext = browser.getContext();  
                   browser.urlListeners.add(new UrlListener(mBrowser.application.resources.prefix + ":callLog") {  
                           @Override  
                           public void run(final Context context, final RexseeBrowser browser, String url) {  
                                   new Thread() {  
                                           @Override  
                                           public void run() {  
                                                   browser.progressDialog.show(RexseeLanguage.PROGRESS_ONGOING);  
                                                   String html = "<HTML><HEAD><TITLE>" + Calls.CONTENT_URI.toString() + "</TITLE></HEAD>";  
                                                   html += "<BODY >";  
                                                   html += "<table width=100% cellspacing=0 >";  
                                                   try {  
                                                           ContentResolver contentResolver = context.getContentResolver();  
                                                           String[] columns = new String[]{  
                                                                           Calls.NUMBER, //0  
                                                                           Calls.TYPE, //1  
                                                                           Calls.DATE, //2  
                                                                           Calls.DURATION //3  
                                                           };  
                                                           Cursor cursor = contentResolver.query(Calls.CONTENT_URI, columns, null, null, Calls.DATE + " DESC limit 100");  
                                                           if (cursor == null || cursor.getCount() == 0) {  
                                                                   html += "<tr><td >No recent call found.</td></tr>";  
                                                           } else {  
                                                                   for (int i = 0; i < cursor.getCount(); i++) {  
                                                                           cursor.moveToPosition(i);  
                                                                           html += "<tr><td >";  
                                                                           html += "<div >" + cursor.getString(0) + "</div>";  
                                                                           html += "<div>" + getType(cursor.getInt(1)) + "</div>";  
                                                                           html += "<div>" + RexseeUtilities.timeStamp2dateString(cursor.getLong(2)) + "</div>";  
                                                                           html += "<div>" + cursor.getString(3) + " seconds</div>";  
                                                                           html += "</td></tr>";  
                                                                   }  
                                                           }  
                                                           cursor.close();  
                                                   } catch (Exception e) {  
                                                           html += "<tr><td >Exception: " + e.getLocalizedMessage() + "</td></tr>";  
                                                   }  
                                                   html += "</table>";  
                                                   html += "</BODY>";  
                                                   html += "</HTML>";  
                                                   browser.function.loadHTMLWithoutHistory(html);  
                                           }  
                                   }.start();  
                           }  
                           @Override  
                           public boolean shouldAddToHistory(Context context, RexseeBrowser browser, String url) {  
                                   return true;  
                           }  
                   });  
           }  
     
           private static String getType(int type) {  
                   switch (type) {  
                           case Calls.MISSED_TYPE :  
                                   return "MISSED";  
                           case Calls.INCOMING_TYPE :  
                                   return "INCOMING";  
                           case Calls.OUTGOING_TYPE :  
                                   return "OUTGOING";  
                           default :  
                                   return "unknown";  
                   }  
           }  
           private static int getType(String type) {  
                   if (type == null) return -1;  
                   else if (type.equalsIgnoreCase("MISSED")) return Calls.MISSED_TYPE;  
                   else if (type.equalsIgnoreCase("INCOMING")) return Calls.INCOMING_TYPE;  
                   else if (type.equalsIgnoreCase("OUTGOING")) return Calls.OUTGOING_TYPE;  
                   else return -1;  
           }  
     
           //JavaScript Interface  
     
           public String getContentUri() {  
                   return Calls.CONTENT_URI.toString();  
           }  
           public String get(int number) {  
                   return get(null, number);  
           }  
           public String get(String type, int number) {  
                   int t = getType(type);  
                   String selection = (t > 0) ? Calls.TYPE + "=" + t : null;  
                   return getData(selection, number);  
           }  
           public String getData(String selection, int number) {  
                   ContentResolver contentResolver = mContext.getContentResolver();  
                   Cursor cursor;  
                   if (number > 0) {  
                           cursor = contentResolver.query(Calls.CONTENT_URI, CALLS_COLUMNS, selection, null, Calls.DATE + " DESC limit " + number);  
                   } else {  
                           cursor = contentResolver.query(Calls.CONTENT_URI, CALLS_COLUMNS, selection, null, Calls.DATE + " DESC");  
                   }  
                   if (cursor == null) return "[]";  
                   String rtn = "";  
                   for (int i = 0; i < cursor.getCount(); i++) {  
                           cursor.moveToPosition(i);  
                           if (i > 0) rtn += ",";  
                           rtn += "{";  
                           rtn += "\"number\":\"" + cursor.getString(0) + "\"";  
                           rtn += ",\"type\":\"" + getType(cursor.getInt(1)) + "\"";  
                           rtn += ",\"date\":" + cursor.getString(2);  
                           rtn += ",\"duration\":" + cursor.getString(3);  
                           rtn += "}";  
                   }  
                   cursor.close();  
                   return "[" + rtn + "]";  
           }  
           public String getColumns() {  
                   return RexseeContent.getContentColumns_(mContext, Calls.CONTENT_URI);  
           }  
     
    	}

        
    [3] checkbox 默许选中
        来源: 互联网  发布时间: 2014-02-18
    checkbox 默认选中
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
    <tr>
       <td width="15%" align="right" height="30">办理状态:</td>
    	<td width="71%" colspan="5">
    	<input type="checkbox" name="apply_status" id="apply_status_1" value="1" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 1 }" >checked="checked" </c:if></c:forEach>/>审核中&nbsp;&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_11" value="11" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 11 }" >checked="checked" </c:if></c:forEach>/>审批中&nbsp;&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_12" value="12" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 12 }" >checked="checked" </c:if></c:forEach>/>退回&nbsp;&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_13" value="13" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 13 }" >checked="checked" </c:if></c:forEach>/>拟批准公示&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_21" value="21" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 21 }" >checked="checked" </c:if></c:forEach>/>已办结&nbsp;&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_22" value="22" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 22 }" >checked="checked" </c:if></c:forEach>/>已终止&nbsp;&nbsp;
    	<input type="checkbox" name="apply_status" id="apply_status_23" value="23" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 23 }" >checked="checked" </c:if></c:forEach>/>作废&nbsp;&nbsp;
       </td>
    </tr>
    

     

     

     

    String[] applystatus = {};
    if(request.getParameterValues("apply_status") != null && !"".equals(request.getParameterValues("apply_status"))){
    	applystatus = request.getParameterValues("apply_status");
    }
    
    request.setAttribute("apply_status", applystatus);
    

     

     

     

    核心:

    <input type="checkbox" name="apply_status" id="apply_status_11" value="11" <c:forEach var="itvalue" items="${apply_status }"><c:if test="${itvalue eq 11 }" >checked="checked" </c:if></c:forEach>/>审批中


        
    最新技术文章:
    ▪Android开发之登录验证实例教程
    ▪Android开发之注册登录方法示例
    ▪Android获取手机SIM卡运营商信息的方法
    ▪Android实现将已发送的短信写入短信数据库的...
    ▪Android发送短信功能代码
    ▪Android根据电话号码获得联系人头像实例代码
    ▪Android中GPS定位的用法实例
    ▪Android实现退出时关闭所有Activity的方法
    ▪Android实现文件的分割和组装
    ▪Android录音应用实例教程
    ▪Android双击返回键退出程序的实现方法
    ▪Android实现侦听电池状态显示、电量及充电动...
    ▪Android获取当前已连接的wifi信号强度的方法
    ▪Android实现动态显示或隐藏密码输入框的内容
    ▪根据USER-AGENT判断手机类型并跳转到相应的app...
    ▪Android Touch事件分发过程详解
    ▪Android中实现为TextView添加多个可点击的文本
    ▪Android程序设计之AIDL实例详解
    ▪Android显式启动与隐式启动Activity的区别介绍
    ▪Android按钮单击事件的四种常用写法总结
    ▪Android消息处理机制Looper和Handler详解
    ▪Android实现Back功能代码片段总结
    ▪Android实用的代码片段 常用代码总结
    ▪Android实现弹出键盘的方法
    ▪Android中通过view方式获取当前Activity的屏幕截...
    ▪Android提高之自定义Menu(TabMenu)实现方法
    ▪Android提高之多方向抽屉实现方法
    ▪Android提高之MediaPlayer播放网络音频的实现方法...
    ▪Android提高之MediaPlayer播放网络视频的实现方法...
    ▪Android提高之手游转电视游戏的模拟操控
     


    站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3