请问 如果要在hastable放100个随机数防止重放攻击的键值对(不能重复)取到第50个的值输出,更新第51个的值要怎么写?

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)我想用JavaScript生成1到100之间的100个不能重复的随机数,不需要排序,只生成100个不_百度知道
我想用JavaScript生成1到100之间的100个不能重复的随机数,不需要排序,只生成100个不
我想用JavaScript生成1到100之间的100个不能重复的随机数,不需要排序,只生成100个不重复的随机数就行了
代码如何写
var getRandomArray = function() {var i = 0,s = '',sp = ',',while (i & 100) {// 产生1-100的随机数next = Math.random() * 100 + 1;// 判断产生的数是否在随机数字符串里if (s.indexOf(next) === -1) {// 不存在// 则加上这条s += next +// 并且记数器加1i++;}// 否则记数器不加1,继续循环}// 最后得到的是xx,xx,形式的字符串// 因为split函数会保留最后一个分隔符后的数// 所以通过slice(0,-1)去掉最后一个字符(也就是,号)// 这样99个分隔符拼成的字符串就会被,号分割// 成100个随机数组了return s.slice(0, -1).split(',');}alert(getRandomArray());
采纳率:68%
你确定是1-100,而不是1-1000或者10000??
为您推荐:
其他类似问题
随机数的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。/ YDJW_RCHC
项目语言:ANDROID
权限:read-only(如需更高权限请先加入项目)
YDJW_RCHC/
Index: DownUtil.java
===================================================================
--- DownUtil.java (revision 0)
+++ DownUtil.java (revision 2)
@@ -0,0 +1,696 @@
+package com.mobile.
+import java.io.F
+import java.io.FileInputS
+import java.io.InputS
+import java.io.RandomAccessF
+import java.net.HttpURLC
+import java.net.URL;
+import java.util.LinkedHashM
+import java.util.M
+import java.util.UUID;
+import java.util.regex.M
+import java.util.regex.P
+import java.util.zip.ZipE
+import java.util.zip.ZipInputS
+import org.json.JSONO
+import org.kobjects.base64.Base64;
+import android.content.C
+import android.os.H
+import android.os.M
+public class DownUtil {
*错误时倒退的字节数
+ private int backSteap = 1;
* 二进制下载错误次数,重头开始重下超过N次就换成WEBSERVICE文本下载。
+ private int binDownErrorTimes = 0;
* 下载失败 常量随便设,只是防止handler值冲突而已
+ public static final int ERROR = 148463;
+ public boolean downFile(FileInfoEx file,Context context) {
return downFile(file, null,context);
//改为用WebService方式下载 DWQ
return downFile2(file, null);
webService请求用这个
+ public FileInfoEx getFileInfo2(String downloadUrl,Context context) {
com.mobile.util.DownUtil.FileInfoEx file = new com.mobile.util.DownUtil.FileInfoEx();
Mapx params = new Mapx();
String url = &&;//&androidserver/ydjw_IdCardDown.jsp&;
String strRet = WSUtil.getHttpRequest(url, params.toHttpPostStr(),context);
OperationResult result = OperationResult.fromJsonObject(new JSONObject(strRet));
if(result.getResultCode()!=0){
file.fileSize = result.getResultCode();
file.fileName = result.getResultMessage();
file.url = downloadU
} catch (Exception ex) {
ex.printStackTrace();
二进制方式下载,速度快,但是在三所平台下不稳定
+ public boolean downFile(FileInfoEx file, Handler handler,Context context) {
if(file.downBytes == 0)
binDownErrorTimes++;
//二进制从头开始下载错误超过2次,换HTTP方式下载
//if(binDownErrorTimes & 1)
if(binDownErrorTimes & 2)
return downFile2(file, handler,context);
URL url = new URL(file.url);
HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.setConnectTimeout(5 * 1000);
http.setRequestMethod(&GET&);
.setRequestProperty(
&image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*&);
http.setRequestProperty(&Accept-Language&, &zh-CN&);
http.setRequestProperty(&Referer&, file.url.toString());
http.setRequestProperty(&Charset&, &UTF-8&);
int startPos = file.downB// 开始位置
int endPos = file.fileS// 结束位置
.setRequestProperty(&Range&, &bytes=& + startPos + &-&
+ endPos);// 设置获取实体数据的范围
.setRequestProperty(
&User-Agent&,
&Mozilla/4.0 ( MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.; .NET CLR 3.5.30729)&);
http.setRequestProperty(&Connection&, &Keep-Alive&);
InputStream inStream = http.getInputStream();
byte[] buffer = new byte[500000];
int offset = 0;
// 读ZIP数据时连续取到0字节数据的次数
int readZeroCount = 0;
//创建文件夹 add by dwq at
if(!file.savePath.endsWith(&/&))
file.savePath += &/&;
String dirName =file.savePath+file.fileN
dirName=dirName.substring(0,dirName.lastIndexOf(&/&));
File dir = new File(dirName);
if(!dir.exists())
dir.mkdirs();
// print(&Thread & + this.threadId +
// & start download from position &+ startPos);
RandomAccessFile threadfile = new RandomAccessFile(file.savePath
+ &/& + file.fileName, &rwd&);
threadfile.seek(startPos);
int noDataTimes = 0;
ZipInputStream zin = new ZipInputStream(new FileInputStream(
file.savePath + &/& + file.fileName));
file.exactsBytes = 0;
byte[] binData = new byte[500000];
ZipEntry ze =
int zeExtracted = 0;
// 单个子文件解压后的长度
int fileLenExtracted = 0;
// 预下载缓存大小
int zipBufferDataLen = 100000;
// int zipBufferDataLen = file.fileSize / 5;
// if(zipBufferDataLen & 100000)
// zipBufferDataLen = 100000;
if (startPos == 0)
backSteap = zipBufferDataLen * 20;
while ((offset = inStream.read(buffer, 0, buffer.length)) != -1) {
if (file.cancel)
if (offset & 0) {
// 写入APK文件
threadfile.write(buffer, 0, offset);
file.downBytes +=
// ZIP校验
if (file.isZip) {
if (file.cancel)
if (ze == null) {
if (file.downBytes - file.exactsBytes & zipBufferDataLen) // 下载一定的数据才开始解压
ze = zin.getNextEntry();
if (file.downBytes &= (file.exactsBytes
+ ze.getCompressedSize() + zipBufferDataLen)) // 数据够才读
if (zeExtracted == 444)
zeExtracted = (int) (zeExtracted * 1.0);
fileLenExtracted = 0;
while (true) {
.read(binData, 0,
binData.length);
fileLenExtracted +=
if (j == 0)
readZeroCount++;
readZeroCount = 0;
if (readZeroCount & 50) // 处理解压过程中卡住的情况
if (j == -1)
// handler.sendMessage(du.generalMsg(10,
// &解压中...&));
if (ze.getCompressedSize() &= 0)
file.exactsBytes += ze
.getCompressedSize();
file.exactsBytes += fileLenE
zeExtracted++;
if (handler != null)
.sendMessage(generalMsg(13, &.&));
} else // 数据不够,则跳出去下次再读
if (file.downBytes - file.exactsBytes & zipBufferDataLen) {
} while ((ze = zin.getNextEntry()) != null);
} catch (Exception ex) // 解压出错
String msg = &校验出错,倒退下载.& + ex.getMessage()
+ &,zeExtracted:& + zeExtracted
+ & downBytes:& + file.downBytes
+ & ExactsBytes:& + file.exactsB
if (ze != null)
msg += &.filename=& + ze.getName();
// file.downBytes -=
file.downBytes = file.exactsB
file.downBytes -= backS
file.downBytes = 0;
//暂时测试 *****************
backSteap *= 2; // 每次倒退更多
if (file.downBytes & 0)
file.downBytes = 0;
threadfile.setLength(file.downBytes); // 加这一句,下次再进来下载时,就不会校验太多数据过去
threadfile.close();
inStream.close();
if (handler != null) {
handler.sendMessage(generalMsg(ERROR, msg));
} // end if offset==0
noDataTimes = 0;
String msg = &downloaded:& + file.downBytes + & Total:&
+ file.fileS
if (handler != null) {
handler.sendMessage(generalMsg(ERROR, msg));
noDataTimes++;
if (noDataTimes & 10)
Thread.sleep(1000);
// downloader.update(this.threadId, downLength);
// downloader.saveLogFile();
// downloader.append(offset);
} // END WHILE
// 最后ZIP校验
if (file.isZip) {
if (file.cancel)
if (ze == null) {
// if (file.downBytes - file.exactsBytes &
// zipBufferDataLen) // 下载一定的数据才开始解压
ze = zin.getNextEntry();
while (true) {
j = zin.read(binData, 0, binData.length);
if (j == -1)
// handler.sendMessage(du.generalMsg(10, i +
// &解压中...&));
if (handler != null)
handler.sendMessage(generalMsg(13, &.&));
file.exactsBytes += ze.getCompressedSize();
} while ((ze = zin.getNextEntry()) != null);
} catch (Exception ex) // 解压出错
file.downBytes -= backS
backSteap *= 2; // 每次倒退更多
file.downBytes = 0;
//暂时测试*****************
if (file.downBytes & 0)
file.downBytes = 0;
threadfile.setLength(file.downBytes); // 加这一句,下次再进来下载时,就不会校验太多数据过去
threadfile.close();
inStream.close();
if (handler != null) {
handler.sendMessage(generalMsg(10,
&解压出错2,倒退下载.exactsBytes=& + file.exactsBytes
+ & & + ex.getMessage()));
if(threadfile.length() & file.downBytes)
threadfile.setLength(file.downBytes);// 加这一句,避免有时候多下载数据导致文件损坏问题
threadfile.close();
inStream.close();
// print(&Thread & + this.threadId + & download finish&);
// this.finish =
} catch (Exception e) {
// this.downLength = -1;
// print(&Thread &+ this.threadId+ &:&+ e);
e.printStackTrace();
file.downBytes = 0;
//暂时测试************************
if (handler != null) {
handler.sendMessage(generalMsg(10, &ERROR:& + e.getMessage()));
+ public FileInfoEx getFileInfo(String downloadUrl) {
FileInfoEx file = new FileInfoEx();
file.url = downloadU
URL url = new URL(downloadUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setRequestMethod(&GET&);
.setRequestProperty(
&image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*&);
conn.setRequestProperty(&Accept-Language&, &zh-CN&);
conn.setRequestProperty(&Referer&, downloadUrl);
conn.setRequestProperty(&Charset&, &UTF-8&);
.setRequestProperty(
&User-Agent&,
&Mozilla/4.0 ( MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.; .NET CLR 3.5.30729)&);
conn.setRequestProperty(&Connection&, &Keep-Alive&);
conn.connect();
printResponseHeader(conn);
if (conn.getResponseCode() == 200) {
int fileSize = conn.getContentLength();// 根据响应获取文件大小
if (fileSize &= 0)
throw new RuntimeException(&Unkown file size &);
file.fileSize = fileS
String filename = getFileName(conn, downloadUrl);
file.fileName =
conn.disconnect();
} catch (Exception ex) {
ex.printStackTrace();
* WebService 文本方式下载,速度慢,稳定
* @param file
* @param handler
+ public boolean downFile2(FileInfoEx file, Handler handler,Context context) {
int iErrorTimes = 0;
int iBlockSize = 256000;// 每次下载256K
//创建文件夹 add by dwq at
if(!file.savePath.endsWith(&/&))
file.savePath += &/&;
String dirName =file.savePath+file.fileN
dirName=dirName.substring(0,dirName.lastIndexOf(&/&));
File dir = new File(dirName);
if(!dir.exists())
dir.mkdirs();
RandomAccessFile threadfile = new RandomAccessFile(file.savePath
+ &/& + file.fileName, &rwd&);
int startPos = file.downB
threadfile.seek(startPos);
if(file.url.indexOf(&/Mobile/&) != -1)
//二进制下载时,去掉文件前面的HTTP
file.url = file.url.substring(file.url.indexOf(&/Mobile/&) + 8);
byte[] binD
int downTimes = 0;
while (true) {
if (file.cancel)
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(10,&第& + ++downTimes + & 块下载开始!start:& + file.downBytes + & Total:&
+ file.fileSize));
binData = DownFile(file.url, file.downBytes, iBlockSize,context);
threadfile.write(binData);
file.downBytes += binData.
if (binData.length != iBlockSize) {
if(file.downBytes & file.fileSize)
throw new Exception(&字节超出&);
iErrorTimes = 0;
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(10,&downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
} catch (Exception ex) {
ex.printStackTrace();
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(12,&错误:&+ ex.getMessage() + & downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
iErrorTimes++;
if (iErrorTimes & 5)
} catch (Exception ex) {
ex.printStackTrace();
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(12,&错误:&+ ex.getMessage() + & downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
+ private byte[] DownFile(String fileName, int startPos, int size,Context context)
throws Exception {
String keys = &filename,startpos,size,iszip&;
String values = fileName + &,& + startPos + &,& + size + &,0&;
//测试环境代码
String strRet = WSUtil.getWebserviceXML(&DOWNFILE&, &30376&, &a&,
&1.0.0.1&, keys, values);
//正式环境换成正规代码
上面imports注释也要打开
WSParams params = new WSParams();
params.AddParameters(&filename&,fileName);
params.AddParameters(&startpos&,String.valueOf(startPos));
params.AddParameters(&size&,String.valueOf(size));
params.AddParameters(&iszip&,&0&);
String strRet = WSUtil.getWebserviceXML(context,&DOWNFILE&,params);
OperationResult result = OperationResult.fromJsonObject(new JSONObject(
if (result.getResultCode() == 0) {
String sBase64 = result.getResultMessage();
byte[] binData = Base64.decode(sBase64);
return binD
throw new Exception(result.getResultMessage());
// return new byte[0];
* 获取文件名
+ private String getFileName(HttpURLConnection conn, String url) {
String filename = url.substring(url.lastIndexOf('/') +
if (filename == null || &&.equals(filename.trim())) {// 如果获取不到文件名称
for (int i = 0;; i++) {
String mine = conn.getHeaderField(i);
if (mine == null)
if (&content-disposition&.equals(conn.getHeaderFieldKey(i)
.toLowerCase())) {
Matcher m = Pattern.compile(&.*filename=(.*)&).matcher(
mine.toLowerCase());
if (m.find())
return m.group(1);
filename = UUID.randomUUID() + &.tmp&;// 默认取一个文件名
* 校验APK文件
* @param filePath
* @param handler
+ public boolean verifyApk(String filePath, Handler handler) {
FileInputStream inS
inStream = new FileInputStream(filePath);
ZipInputStream zin = new ZipInputStream(inStream);
while ((ze = zin.getNextEntry()) != null) {
byte[] binData = new byte[500000];
while (true) {
j = zin.read(binData, 0, binData.length);
if (j == -1)
// handler.sendMessage(du.generalMsg(10, i + &解压中...&));
// handler.sendMessage(generalMsg(10, ze.getName() +
// &解压完成...&));
inStream.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
handler.sendMessage(generalMsg(12, &解压错误!& + e.getMessage()));
+ public Message generalMsg(int what, String message) {
Message msg = new Message();
msg.what =
* 打印Http头字段
* @param http
+ public static void printResponseHeader(HttpURLConnection http) {
Map&String, String& header = getHttpResponseHeader(http);
for (Map.Entry&String, String& entry : header.entrySet()) {
String key = entry.getKey() != null ? entry.getKey() + &:& : &&;
System.out.println(key + entry.getValue());
* 获取Http响应头字段
* @param http
+ public static Map&String, String& getHttpResponseHeader(
HttpURLConnection http) {
Map&String, String& header = new LinkedHashMap&String, String&();
for (int i = 0;; i++) {
String mine = http.getHeaderField(i);
if (mine == null)
header.put(http.getHeaderFieldKey(i), mine);
+ // private PackageInfo parsePackage(String archiveFilePath, int flags){
+ // Class PackageParserClass =
+ // Class.forName(&android.content.pm.PackageParser&);
+ // Class PackageClass =
+ // Class.forName(&android.content.pm.PackageParser$Package&);
+ // Constructor c = PackageParserClass.getConstructor(String.class);
+ // Object packageParser = c.newInstance(archiveFilePath);
+ // //PackageParser packageParser = new PackageParser(archiveFilePath);
+ // DisplayMetrics metrics = new DisplayMetrics();
+ // metrics.setToDefaults();
+ // final File sourceFile = new File(archiveFilePath);
+ // Method m = PackageParserClass.getMethod(&parsePackage&, new
+ // Class[]{File.class,String.class,DisplayMetrics.class,Integer.class});
+ // Object pkg = m.invoke(packageParser, new Object[]{sourceFile,
+ // archiveFilePath, metrics, 0});
+ // // PackageParser.Package pkg = packageParser.parsePackage(
+ // // sourceFile, archiveFilePath, metrics, 0);
+ // if (pkg == null) {
+ // Method m2 = PackageParserClass.getMethod(&collectCertificates&, new
+ // Class[]{PackageClass.getClass(),Integer.class});
+ // m2.invoke(packageParser, new Object[]{PackageClass, 0});
+ // //packageParser.collectCertificates(pkg, 0);
+ // Method m3 = PackageParserClass.getMethod(&collectCertificates&, new
+ // Class[]{PackageClass.getClass(),Integer.class});
+ // m3.invoke(packageParser, new Object[]{PackageClass, 0});
+ // return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0);
* 人车核查,通过WebService下载
* @param file
* @param handler
* @param context
+ public boolean downFile3(FileInfoEx file, Handler handler,Context context) {
int iErrorTimes = 0;
int iBlockSize = (int) (file.fileSize*0.1);// 每次下载256K
//创建文件夹 add by dwq at
if(!file.savePath.endsWith(&/&))
file.savePath += &/&;
String dirName =file.savePath+file.fileN
dirName=dirName.substring(0,dirName.lastIndexOf(&/&));
File dir = new File(dirName);
if(!dir.exists())
dir.mkdirs();
RandomAccessFile threadfile = new RandomAccessFile(file.savePath
+ &/& + file.fileName, &rwd&);
int startPos = file.downB
threadfile.seek(startPos);
if(file.url.indexOf(&/Mobile/&) != -1)
//二进制下载时,去掉文件前面的HTTP
file.url = file.url.substring(file.url.indexOf(&/Mobile/&) + 8);
byte[] binD
int downTimes = 0;
while (true) {
if (file.cancel)
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(10,&第& + ++downTimes + & 块下载开始!start:& + file.downBytes + & Total:&
+ file.fileSize));
binData = DownFile(file.url, file.downBytes, iBlockSize,context);
threadfile.write(binData);
file.downBytes += binData.
if (binData.length != iBlockSize) {
if(file.downBytes & file.fileSize)
throw new Exception(&字节超出&);
iErrorTimes = 0;
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(10,&downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
} catch (Exception ex) {
ex.printStackTrace();
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(12,&错误:&+ ex.getMessage() + & downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
iErrorTimes++;
if (iErrorTimes & 5)
} catch (Exception ex) {
ex.printStackTrace();
//消息通知
if (handler != null) {
handler.sendMessage(generalMsg(12,&错误:&+ ex.getMessage() + & downloaded:& + file.downBytes + & Total:&
+ file.fileSize));
* 文件下载结构
* @author DWQ
+ public class FileInfoEx {
public String fileName = &&;
* 保存路径,不包含文件名 切记
public String savePath = &&;
* 请求服务器路径
public String url = &&;
* 文件总字节数
public int fileSize = 0;
* 当前下载数
public int downBytes = 0;
* 解压次数
public int exactsBytes = 0;
* 是否ZIP文件,APK安装包也是ZIP文件,如果为TRUE,下载时会同时做ZIP校验 默认false
public boolean isZip =
// public int errorTimes = 0;
* 设为TRUE立即停止下载
public boolean cancel =
Property changes on: DownUtil.java
___________________________________________________________________
Added: svn:executable
Index: AppConfig.java
===================================================================
--- AppConfig.java (revision 0)
+++ AppConfig.java (revision 2)
@@ -0,0 +1,159 @@
+package com.mobile.
+ * @author Administrator
+public class AppConfig {
+ public static final String APKNAME=&MobileAnd.apk&;
* 运营商编号
+ public static String mcc = &&;
* 当前应用程序版本号
从AndroidMainfest.xml中获取
+ public static String appVersion = &&;
* 当前应用程序版服务端本号
+ public static String appVersionService = &&;
+ public static String PackageName=&com.mobile.main&;
+ public static int VersionCode=2;
+ public static final
String CLASS=&LoginWebActivity&;
* share文件名称
+ public static final String SHARE_TITLE=&mobileAnd&;
* 蓝牙地址 key
+ public static final String BT_ADDR=&address&;
* 手机号码
+ public static String PHONENUM =& &;
+ public static String IMEI=& &;
+ public static String IMSI=& &;
+ public static String KEY=& &;
+ public static String TFCARD=&&;
* 基站扇区LAC ADD BY DWQ
+// public static String LAC = &&;
* 基站编号CID ADD BY DWQ
+// public static String CID = &&;
* vpn 包名
+ public static final String VPN_PackageName=&com.wonder.vpnClient&;
* vpn 主类
+ public static final String VPN_MAIN_CLASS=&com.wonder.vpnClient.vpnClient&;
* 手机版本号
+ public static String PHONE_SDK = &&;
+ public static String PHONE_MODEL = &&;
+ public static String PHONE_RELEASE = &&;
+ public static final
String PATH_CACHE=&YdqwHD/cache&;
+ public static final
String PATH_MEDIAS=&/YdqwHD/medias/&;
+ public static boolean isGetJcry=
+ public static boolean isRefreshDiary=
+ public static final String[][] MIME_MapTable = {
// {后缀名,MIME类型}
{ &.3gp&, &video/3gpp& },
{ &.apk&, &application/vnd.android.package-archive& },
{ &.asf&, &video/x-ms-asf& },
{ &.avi&, &video/x-msvideo& },
{ &.bin&, &application/octet-stream& },
{ &.bmp&, &image/bmp& },
{ &.c&, &text/plain& },
{ &.class&, &application/octet-stream& },
{ &.conf&, &text/plain& },
{ &.cpp&, &text/plain& },
{ &.doc&, &application/msword& },
{ &.docx&,
&application/vnd.openxmlformats-officedocument.wordprocessingml.document& },
{ &.xls&, &application/vnd.ms-excel& },
{ &.xlsx&,
&application/vnd.openxmlformats-officedocument.spreadsheetml.sheet& },
{ &.exe&, &application/octet-stream& },
{ &.gif&, &image/gif& },
{ &.gtar&, &application/x-gtar& },
{ &.gz&, &application/x-gzip& },
{ &.h&, &text/plain& },
{ &.htm&, &text/html& },
{ &.html&, &text/html& },
{ &.jar&, &application/java-archive& },
{ &.java&, &text/plain& },
{ &.jpeg&, &image/jpeg& },
{ &.jpg&, &image/jpeg& },
{ &.js&, &application/x-javascript& },
{ &.log&, &text/plain& },
{ &.m3u&, &audio/x-mpegurl& },
{ &.m4a&, &audio/mp4a-latm& },
{ &.m4b&, &audio/mp4a-latm& },
{ &.m4p&, &audio/mp4a-latm& },
{ &.m4u&, &video/vnd.mpegurl& },
{ &.m4v&, &video/x-m4v& },
{ &.mov&, &video/quicktime& },
{ &.mp2&, &audio/x-mpeg& },
{ &.mp3&, &audio/x-mpeg& },
{ &.mp4&, &video/mp4& },
{ &.mpc&, &application/vnd.mpohun.certificate& },
{ &.mpe&, &video/mpeg& },
{ &.mpeg&, &video/mpeg& },
{ &.mpg&, &video/mpeg& },
{ &.mpg4&, &video/mp4& },
{ &.mpga&, &audio/mpeg& },
{ &.msg&, &application/vnd.ms-outlook& },
{ &.ogg&, &audio/ogg& },
{ &.pdf&, &application/pdf& },
{ &.png&, &image/png& },
{ &.pps&, &application/vnd.ms-powerpoint& },
{ &.ppt&, &application/vnd.ms-powerpoint& },
{ &.pptx&,
&application/vnd.openxmlformats-officedocument.presentationml.presentation& },
{ &.prop&, &text/plain& }, { &.rc&, &text/plain& },
{ &.rmvb&, &audio/x-pn-realaudio& }, { &.rtf&, &application/rtf& },
{ &.sh&, &text/plain& }, { &.tar&, &application/x-tar& },
{ &.tgz&, &application/x-compressed& }, { &.txt&, &text/plain& },
{ &.wav&, &audio/x-wav& }, { &.wma&, &audio/x-ms-wma& },
{ &.wmv&, &audio/x-ms-wmv& },
{ &.wps&, &application/vnd.ms-works& }, { &.xml&, &text/plain& },
{ &.z&, &application/x-compress& },
{ &.zip&, &application/x-zip-compressed& }, { &&, &*/*& } };
Property changes on: AppConfig.java
___________________________________________________________________
Added: svn:executable
Index: UserCodeNo.java
===================================================================
--- UserCodeNo.java (revision 0)
+++ UserCodeNo.java (revision 2)
@@ -0,0 +1,81 @@
+package com.mobile.
+import android.content.C
+import com.mobile.data.DataT
+import com.wb_ydjw.unit.StaticJ
+public class UserCodeNo {
+ private String npolice_id = &&;
+ private String sunit_code = &&;
+ private String spolice_no = &&;
+ private String pid = &&;
+ private int sunit_level = -1;
//返回值级别
1:厅级 2:市局 3:分局 4:派出所
+ public UserCodeNo(Context context) throws Exception{
getUser(context);
+ public void getUser(Context context) throws Exception{
String canshu = &&;
if(StringUtil.isEmpty(spolice_no)){
canshu = &spolice_no=&+UserConfig.
canshu = &spolice_no=&+spolice_
String url = &androidserver/getUserCode.jsp&;
String url = StaticJsp.getUserC
String jsonStr = WSUtil.getHttpRequest(url, canshu,context);
DataTable dt = ExtendDataSet.JSONStringToDataTable(jsonStr);
if(dt.getRowCount()&0){
this.npolice_id = dt.getString(0, &npolice_id&);
this.sunit_code = dt.getString(0, &sunit_code&);
this.sunit_level = dt.getInt(0, &sunit_level&);
this.pid = dt.getString(0, &pid&);
UserConfig.za_sunit_code = dt.getString(0, &sunit_code&);
UserConfig.za_npolice_id = dt.getString(0, &npolice_id&);
UserConfig.za_sunit_level = dt.getInt(0, &sunit_level&);
UserConfig.za_pid = dt.getString(0, &pid&);
System.out.println(&治安查询无数据&);
+ public int getSunit_level() {
return sunit_
+ public void setSunit_level(int sunitLevel) {
sunit_level = sunitL
+ public String getSpolice_no() {
return spolice_
+ public void setSpolice_no(String spoliceNo) {
spolice_no = spoliceNo;
+ public String getNpolice_id() {
return npolice_
+ public void setNpolice_id(String npoliceId) {
npolice_id = npoliceId;
+ public String getSunit_code() {
return sunit_
+ public void setSunit_code(String sunitCode) {
sunit_code = sunitC
+ public String getPid() {
+ public void setPid(String pid) {
this.pid =
Property changes on: UserCodeNo.java
___________________________________________________________________
Added: svn:executable
Index: DateUtil.java
===================================================================
--- DateUtil.java (revision 0)
+++ DateUtil.java (revision 2)
@@ -0,0 +1,273 @@
+package com.mobile.
+import java.text.DateF
+import java.text.ParseE
+import java.text.ParseP
+import java.text.SimpleDateF
+import java.util.C
+import java.util.D
+import java.util.L
+ * 日期操作类
+ * @author DWQ
+public class DateUtil {
+ public static final String Format_Date = &yyyy-MM-dd&;
+ public static final String Format_Time = &HH:mm:ss&;
+ public static final String Format_DateTime = &yyyy-MM-dd HH:mm:ss&;
+ public static String getCurrentDate() {
return new SimpleDateFormat(&yyyy-MM-dd&).format(new Date());
* 获取day天前的时间
* @param day
+ public static String getDateBefore(int day) {
Calendar now = Calendar.getInstance();
now.setTime(new Date());
now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
return new SimpleDateFormat(&yyyy-MM-dd&).format(now.getTime());
* 获取day天前的时间
* @param day
+ public static String getDateBefore2(int day) {
Calendar now = Calendar.getInstance();
now.setTime(new Date());
now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
return new SimpleDateFormat(&yyyyMMddHHmmss&).format(now.getTime());
+ public static String getCurrentDate(String format) {
SimpleDateFormat t = new SimpleDateFormat(format);
return t.format(new Date());
+ public static String getCurrentTime() {
return new SimpleDateFormat(&HH:mm:ss&).format(new Date());
+ public static String getCurrentTime(String format) {
SimpleDateFormat t = new SimpleDateFormat(format);
return t.format(new Date());
+ public static String toString(Date date, String format) {
SimpleDateFormat t = new SimpleDateFormat(format);
return t.format(date);
+ public static String getCurrentDateTime() {
String format = &yyyy-MM-dd HH:mm:ss&;
return getCurrentDateTime(format);
+ public static String getCurrentDateTime(String format) {
SimpleDateFormat t = new SimpleDateFormat(format);
return t.format(new Date());
+ public static Date parseDateTime(String str) {
if (StringUtil.isEmpty(str)) {
if (str.length() &= 10)
return parse(str);
return new SimpleDateFormat(&yyyy-MM-dd HH:mm:ss&).parse(str);
} catch (ParseException e) {
e.printStackTrace();
+ public static Date parse(String str) {
if (StringUtil.isEmpty(str))
return new SimpleDateFormat(&yyyy-MM-dd&).parse(str);
} catch (ParseException e) {
e.printStackTrace();
* 取中文日期时间
+ public String getCurrentDateTimeCN() {
Calendar ca = Calendar.getInstance();
int year = ca.get(Calendar.YEAR);
int mouth = ca.get(Calendar.MONTH);
int day = ca.get(Calendar.DATE);
int hour = ca.get(Calendar.HOUR);
int mimute = ca.get(Calendar.MINUTE);
int second = ca.get(Calendar.SECOND);
String time = year + &年& + (mouth + 1) + &月& + day + &日& + hour + &时&
+ mimute + &分& + second + &秒&;
* 字符串日期格式转换成日期格式 add by lixiao at
* @param datetime
* @throws ParseException
+ public static String getStringToTime(String datetime) {
String mDateTime = &&;
Date date =
if (StringUtil.isNotEmpty(datetime)) {
if (datetime.length() == 8) {
// 参数为 例如: 时,返回下面代码执行效果
mDateTime = (datetime.substring(0, 4) + &-&
+ datetime.substring(5, 6) + &-& + datetime.substring(
if (StringUtil.isNotEmpty(datetime)) {
SimpleDateFormat formatter = new SimpleDateFormat(
&yyyy-MM-dd&, Locale.SIMPLIFIED_CHINESE);
date = DateFormat.getDateInstance(DateFormat.SHORT,
Locale.SIMPLIFIED_CHINESE).parse(datetime);
} catch (ParseException e) {
e.printStackTrace();
mDateTime = formatter.format(date);
return mDateT
* 传入数据的格式为00 返回的数据格式为日02时01分00秒
* @param time
+ public static String getFormatDate(String time) {
if (StringUtil.isNotEmpty(time)) {
if (time.length() == 14) {
// 参数为 例如: 时,返回下面代码执行效果
return time.subSequence(0, 4) + &年&
+ time.subSequence(4, 6) + &月&
+ time.subSequence(6, 8) + &日&
+ time.subSequence(8, 10) + &时&
+ time.subSequence(10, 12) + &分&
+ time.subSequence(12, 14) + &秒&;
} else if (time.length() & 9) {//
String temp = (String) time.subSequence(0, 10);
return getFormatTime(temp.replaceAll(&-&, &&));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
* 传入数据的格式为00 返回的数据格式为 02:01:00
* @param time
+ public static String getFormatDate2(String time) {
if (StringUtil.isNotEmpty(time)) {
if (time.length() == 14) {
// 参数为 例如: 时,返回下面代码执行效果
return time.subSequence(0, 4) + &-&
+ time.subSequence(4, 6) + &-&
+ time.subSequence(6, 8) + & &
+ time.subSequence(8, 10) + &:&
+ time.subSequence(10, 12) + &:&
+ time.subSequence(12, 14);
} else if (time.length() & 9) {//
String temp = (String) time.subSequence(0, 10);
return getFormatTime(temp.replaceAll(&-&, &&));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
* 传入数据的格式为 返回的数据格式为日
* @param time
+ public static String getFormatTime(String time) {
if (StringUtil.isNotEmpty(time)) {
if (time.length() == 8) {
// 参数为 例如: 时,返回下面代码执行效果
return time.subSequence(0, 4) + &年&
+ time.subSequence(4, 6) + &月&
+ time.subSequence(6, 8) + &日&;
} else if (time.length() & 9) {//
String temp = (String) time.subSequence(0, 10);
return getFormatTime(temp.replaceAll(&-&, &&));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
* 将String格式时间转换成Date类型
* @param datetime String时间字符串 格式为
yyyy-MM-dd HH:mm:ss
+ public static Date stringToDate(String datetime) {
ParsePosition position = new ParsePosition(0);
SimpleDateFormat dateFormat = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss&);
Date date = dateFormat.parse(datetime, position);
Property changes on: DateUtil.java
___________________________________________________________________
Added: svn:executable
Index: ConstString.java
===================================================================
--- ConstString.java (revision 0)
+++ ConstString.java (revision 2)
@@ -0,0 +1,637 @@
+package com.mobile.
+import java.util.ArrayL
+import java.util.HashM
+import com.mobile3.model.DataT
+import com.wb_ydjw.unit.StaticJ
+public class ConstString {
+ public static com.mobile.data.DataTable dtDk = new com.mobile.data.DataTable();
* 最新警情字典版本
+ public static String NEW_JQZD_VERSION = &&;
* 警情字典版本号
+ public static String JQZD_VERSION = &1.0&;
* 警情字典版本名称
+ public static final String JQZD_VERSION_NAME = &JQZD_VERSION&;
* 授权码请求参数常量
+ public static final String CODE = &code&;
+ public static String AUTHORIZATION_CODE = &&;
+ // public static final String[] messages={&让数据飞一会儿...&, &看花儿还没谢呢,再等等...&,
+ // &数据说我在穿衣服,等等哦...&, &超给力,超努力加载中...&
+ // ,&一般人我不告诉他,其实很快的...&, &守得明月见日开...&, &想想还有什么没填,一会儿就好...&, &点根烟的时间就行...&
+ // ,&看看天上的白云,放松下就好...&, &看天上的乌云,调整下心情就好...&, &Hello!等我下...&, &玩命加载中...&};
+ public static final String[] messages = { &数据加载中...&, &数据加载中...&,
&数据加载中...&, &数据加载中...&, &数据加载中...&, &数据加载中...&, &数据加载中...&,
&数据加载中...&, &数据加载中...&, &数据加载中...&, &数据加载中...&, &数据加载中...& };
+ public static final String baidu_key = &008AD5F9B6C981DF367&;
* 上传罚单广播标记
+ public static String SEND_BROADCAST = &send_broadcast&;
* 读卡跳转广播标记
+ public static String READCARD_BROADCAST = &readcard_broadcast&;
* 保存VPN配置字段和值的HASHMAP
+ public static HashMap&String, String& APN_MAP = new HashMap&String, String&();
* 原始VPNID
+ public static int VPNID = -1;
* 图片数据
+ public static final String[] zhcxTextList = { &返回上一级&, &人口查询& };
* 项目根目录
+ public static final String rootPath = &/Mobile&;
* 主菜单连接地址
+ // public static final String rootMainUrl = &/Mobile/menu/menu.jsp&;
+ public static final String rootMainUrl = StaticJsp.
* 上一个URL
+ public static final String priviousUrl = &&;
+ public static final String currentUrl = &&;
* 用来判断是否跳到主界面 ,还是第一次进入查询界面
+ public static int firstLoad = 0;
+ public static HashMap&String, ArrayList&String&& menuM
* 主DataTable
+ public static DataT
* 菜单DataTable
+ public static DataTable dtM
* 功能菜单DataTable
+ public static DataTable dtP
* 最新文件DataTable
+ public static DataTable dtF
* 道路代码DataTable
+ public static DataTable dtR
* WEBSERVICE返回的XML
+ public static String REPOSE = &&;
* 是否忽略版本号直接进入主菜单
+ public static boolean ISNEGLECT =
* 上一次道路代码
+ public static String LASTDLDM = &&;
* 是否上传基站定位
+ public static boolean IS_UPLOAD_FUZZY =
* 是否上传精确定位
+ public static boolean IS_UPLOAD_ACCURACY =
* 基站定位发送频率
+ public static String FUZZY_RATE = &15s&;
* 精确定位发送频率
+ public static String ACCURACY_RATE = &1m&;
* 定位时间段
+ public static String UPLOAD_TIME_PERIOD = &08:00~12:00@@14:00~18:00&;
* 时间段1开始时间
+ public static long UPLOAD_TIME1_START = 0;
* 时间段1结束时间
+ public static long UPLOAD_TIME1_END = 0;
* 时间段2开始时间
+ public static long UPLOAD_TIME2_START = 0;
* 时间段2结束时间
+ public static long UPLOAD_TIME2_END = 0;
* 广播action
+ public static String EXIT_BROADCAST = &com.mobile.action.EXIT_BROADCAST&;
+ public static final String[] HMT = { &闽&, &京&, &津&, &冀&, &晋&, &蒙&, &辽&,
&吉&, &黑&, &沪&, &苏&, &浙&, &皖&, &桂&, &赣&, &鲁&, &豫&, &湘&, &粤&, &琼&,
&渝&, &川&, &鄂&, &贵&, &云&, &藏&, &陕&, &甘&, &青&, &宁&, &新&, &福建&, &无& };
* 车辆品牌
+ public static String[] CLPPS = { &宝马&, &奔驰&, &比亚迪&, &奇瑞&, &别克& };
* 模拟简易处罚通知书号
+ public static final String MODE_JYCF_BOOKCODE = &000&;
* 模拟强制措施通知书号
+ public static final String MODE_QZCS_BOOKCODE = &000&;
* 模拟违法行为通知书号
+ public static final String MODE_WFXW_BOOKCODE = &000&;
* 模拟违章停车通知书号
+ public static final String MODE_WZTC_BOOKCODE = &000&;
* 模拟文书检验码
+ public static final String MODE_CHECKCODE = &0&;
* 保存非现场上传日志
+ public static final String UPLOAD_FXCCF_LOGNAME = &upload_fxccf.log&;
* 保存现场上传日志
+ public static final String UPLOAD_XCCF_LOGNAME = &upload_xccf.log&;
* 服务器获取的最新版本号
+ public static String VERSION_FROM_SERVER = &&;
* 简易文书类别
+ public static final String WSLB_SIMPLE = &1&;
* 强制措施文书类别
+ public static final String WSLB_FORCE = &3&;
* 违法行为文书类别
+ public static final String WSLB_WFXW = &6&;
* 违法停车文书类别
+ public static final String WSLB_WFTC = &7&;
* 简易程序处罚决定书
+ public static final String SIMPLE_TRAFFIC = &12&;
* 强制措施处罚决定书
+ public static final String FORCE_TRAFFIC = &32&;
* 违法行为处罚决定书
+ public static final String WFXW_TRAFFIC = &62&;
* 违法停车处罚决定书
+ public static final String WFTC_TRAFFIC = &72&;
* 文书最大保存量
+ public static int MAX_STORE = 20;
* 文书最少剩余量
+ public static int MIN_STORE = 20;
* 字典目录
+ public static final String DATA_PATH = android.os.Environment
.getExternalStorageDirectory().getAbsolutePath()
+ &/YdqwHD/dictionary&;
* 主数据库
+ public static final String MOBILEAND_DATA = &mobileand.db&;
* 常用代码库
+ public static final String CYDM_DATA = &cydm.db&;
* 道路代码库
+ public static final String DLDM_DATA = &dldm.db&;
* 交通字典库
+ public static final String JTZD_DATA = &jtzd.db&;
* 违法代码库
+ public static final String WFDM_DATA = &wfdm.db&;
* 行政区划库
+ public static final String XZQH_DATA = &xzqh.db&;
* 文书编号库
+ public static final String WSBH_DATA = &wsbh.db&;
* 违法停车库
+ public static final String WFTC_DATA = &wftc.db&;
* 现场处罚保存库
+ public static final String XCCF_DATA = &xccf.db&;
* 短信模板库
+ public static final String DXMB_DATA = &dxmb.db&;
* 待办警情库
+ public static final String DBJQ_DATA = &Intelligence.db&;
* 常用代码表
+ public static final String CYDM_TABLE = &T_CYDM&;
* 道路代码表
+ public static final String DLDM_TABLE = &T_JT_ZD_DLDM&;
* 违法代码表
+ public static final String WFDM_TABLE = &T_WFPY&;
* 交通字典表
+ public static final String JTZD_TABLE = &T_JTZD&;
* 正式文书编号表
+ public static final String WSBH_TABLE = &T_WSBH&;
* 模拟文书编号表
+ public static final String WSBH_TABLE_MOD = &T_WSBH_MOD&;
* 违法停车罚单临时保存表
+ public static final String WFTC_TABLE = &T_WFTC_TEMP&;
* 现场处罚罚单临时保存表
+ public static final String XCCF_TABLE = &T_XCCF_TEMP&;
* 设置配置表
+ public static final String CFG_TABLE = &T_CONFIG&;
* 离线菜单表
+ public static final String OFFLINE_TABLE = &T_OFFLINE_MENU&;
* 行政区划表
+ public static final String XZQH_TABLE = &T_XZQH&;
* 非现场类型(用于字典判断)
+ public static final String FXCCF = &fxccf&;
* 现场类型(用于字典判断)
+ public static final String XCCF = &xccf&;
* 道路表字段
+ public static final String[] DLDM_TABLE_FIELD = { &DLMC&, &DLMC_PY&, &DM& };
* 中文标题道路
+ public static final String[] DLDM_TABLE_FIELD_TOCN = { &道路名称&, &道路拼音&, &代码& };
* 违法代码表字段
+ public static final String[] WFDM_TABLE_FIELD = { &WFNR&, &WFNRPY&, &WFXW& };
* 中文标题违法代码
+ public static final String[] WFDM_TABLE_FIELD_TOCN = { &违法内容&, &违法拼音&, &代码& };
* 交通字典表字段
+ public static final String[] JTZD_TABLE_FIELD = { &DMZ&, &DMSM1& };
* 中问标题字典
+ public static final String[] JTZD_TABLE_FIELD_TOCN = { &代码值&, &代码名称& };
* 查询全部记录
+ public static final String ALLRESULT = &ALLSRESULT&;
* 客户端名称
+ public static final String CLIENT_RELEASE = &fj_rchc.apk&;
* 客户端名称
+ public static final String DICTIONARY = &mobileand.db|dldm.db|jtzd.db|wfdm.db|xzqh.db|Intelligence.db&;
* APN类型下拉框值
+ public static final String[] APN_TYPE_VALUE = { &福州电信&, &宁德电信&, &宁德移动& };
* APN类型键
+ public static final String[] APN_TYPE_KEY = { &FZ-DX&, &ND-DX&, &ND-YD& };
* APN表字段
+ public static String APN_FIELD = &&;
+ // 以下是配置表字段值
* 最新交通字典版本
+ public static String NEW_JTZD_VERSION = &&;
* 最新道路代码版本
+ public static String NEW_DLDM_VERSION = &&;
* 最新违法代码版本
+ public static String NEW_WFDM_VERSION = &&;
* 最新行政区划版本
+ public static String NEW_XZQH_VERSION = &&;
* 最新待办警情划版本
+ public static String NEW_DBJQ_VERSION = &&;
* 最新MOBILEAND版本
+ public static String NEW_MOBILEAND_VERSION = &&;
* 交通字典版本号
+ public static String JTZD_VERSION = &1.0.0.0&;
* 配置数据库版本号
+ public static String MOBILEAND_VERSION = &1.0.0.0&;
* 道路代码版本号
+ public static String DLDM_VERSION = &1.0.0.0&;
* 违法代码版本号
+ public static String WFDM_VERSION = &1.0.0.1&;
* 行政区划版本号
+ public static String XZQH_VERSION = &1.0.0.0&;
* 是否退出时关闭VPN
+ public static boolean IS_EXIT_WITHVPN =
* 是否退出时关闭蓝牙
+ public static boolean IS_EXIT_WITHBT =
* 字体大小
+ public static String FONT_SIZE = &small&;
* 上次登录警号
+ public static String LAST_USERNAME = &&;
* 上次登录密码
+ public static String LAST_PASSWORD = &&;
* 上次登录民警名字
+ public static String LAST_ZQMJ = &&;
* 上次登录部门编号
+ public static String LAST_BMBH = &&;
* 操作方式
+ public static String OPERAT_STYLE = &cs&;
* 退出时的网络
+ public static String EXIT_NET_CHOOSE = &&;
* 是否保持常亮
+ public static String IS_KEEP_LIGHT = &0&;
+ public static String APN_TYPE = &&;
+ // 以下是配置表字段名
+ public static final String IP_ADDR_NAME = &IP_ADDR&;
+ public static final String IP_ADDR_NAME2 = &IP_ADDR2&;
+ public static final String IF_DELETE = &sfsc&;
+ public static final String IP_PORT_NAME = &IP_PORT&;
+ public static final String IP_PORT_NAME2 = &IP_PORT2&;
* 字体大小
+ public static final String FONT_SIZE_NAME = &FONT_SIZE&;
* 操作方式
+ public static final String OPERAT_STYLE_NAME = &OPERAT_STYLE&;
* 退出时选择的网络
+ public static final String NET_CHOOSE_NAME = &EXIT_NET_CHOOSE&;
* 是否保持常亮
+ public static final String KEEP_LIGHT_NAME = &IS_KEEP_LIGHT&;
+ public static final String APN_TYPE_NAME = &APN_TYPE&;
* 交通字典版本
+ public static final String JTZD_VERSION_NAME = &JTZD_VERSION&;
* mobileand字典版本
+ public static final String MOBILEAND_VERSION_NAME = &MIBILEAND_VERSION&;
* 道路代码字典版本
+ public static final String DLDM_VERSION_NAME = &DLDM_VERSION&;
* 违法代码字典版本
+ public static final String WFDM_VERSION_NAME = &WFDM_VERSION&;
* 行政区划字典版本
+ public static final String XZQH_VERSION_NAME = &XZQH_VERSION&;
* 待办警情版本
+ public static final String DBJQ_VERSION_NAME = &DBJQ_VERSION&;
* 退出时关闭VPN
+ public static final String EXIT_WITH_VPN_NAME = &EXIT_WITH_VPN&;
* 退出时关闭蓝牙
+ public static final String EXIT_WITH_BT_NAME = &EXIT_WITH_BT&;
* 自动切换接入点apn
+ public static final String AUTO_SWITCH_APN_NAME = &AUTO_SWITCH_APN&;
* 自动启动VPN
+ public static final String AUTO_SWITCH_VPN_NAME = &AUTO_SWITCH_VPN&;
* 上次登录警号
+ public static final String LAST_USERNAME_NAME = &LAST_USERNAME&;
* 上次登录密码
+ public static final String LAST_PASSWORD_NAME = &LAST_PASSWORD&;
* 上次登录民警名字
+ public static final String LAST_ZQMJ_NAME = &LAST_ZQMJ&;
* 上次登录部门编号
+ public static final String LAST_BMBH_NAME = &LAST_BMBH&;
* 文书编号最大保存量
+ public static final String MAX_STORE_NAME = &MAX_STORE&;
* 文书编号最小保存量
+ public static final String MIN_STORE_NAME = &MIN_STORE&;
* 地址选择临时保存
+ public static com.mobile.data.DataTable SAVE_DIZHI_ONE_DATA;
* 地址选择2临时保存
+ public static com.mobile.data.DataTable SAVE_DIZHI_TWO_DATA;
* 查一查 查询数据条件临时保存
+ public static WSParams SAVE_PARAMS;
* 事故处理决定书(临时设定)
+ public static final String SGCL_TRAFFIC = &15&;
* 是否开启读卡器
+ public static boolean isReadCard =
+ public static final String ZAAQJC = &【治安安全检查】&;
+ public static final String ZARKLR = &【治安人口流入】&;
+ public static final String ZARKLC = &【治安人口流出】&;
+ public static final String QBXSJC = &【情报线索检查】&;
+ public static final String JQXX = &【警情信息】&;
+ public static final String AJHFXX = &【案件回访信息】&;
+ public static final String GKYJ = &【管控预警】&;
+ public static final String RHC = &【人核查】&;
+ public static final String CHC = &【车核查】&;
Property changes on: ConstString.java
___________________________________________________________________
Added: svn:executable
Index: FileUtil.java
===================================================================
--- FileUtil.java (revision 0)
+++ FileUtil.java (revision 2)
@@ -0,0 +1,57 @@
+package com.mobile.
+import java.io.FileInputS
+import java.io.FileOutputS
+import java.io.IOE
+import java.text.SimpleDateF
+import android.content.C
+ * @Title: FileUtil.java
+ * @Package com.tch.util
+ * @Description: 与文件有关的类
+ * @author hanchunping
上午08:50:46
+ * @version V1.0
+public class FileUtil {
* @Title: createFileName
* @Description: 文件名 根据当前年月日时分秒生成
+ public static final String createFileName(){
SimpleDateFormat sf = new SimpleDateFormat(&yyyyMMddHHmmss&);
String today = sf.format(new java.util.Date());
}catch (Exception e) {
return &&;
* 读取文件
* @param filename
* @throws IOException
+ public static String read(Context context,String filename) throws IOException{
FileInputStream fis = context.openFileInput(filename);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
return new String(buffer);
* 写入文件
* @throws IOException
+ public static void write(Context context,String content,String filename,int mode) throws IOException{
FileOutputStream fos = context.openFileOutput(filename, mode);
fos.write(content.getBytes());
fos.close();
Property changes on: FileUtil.java
___________________________________________________________________
Added: svn:executable
Index: KeyBoard2.java
===================================================================
--- KeyBoard2.java (revision 0)
+++ KeyBoard2.java (revision 2)
@@ -0,0 +1,2474 @@
+package com.mobile.
+import java.io.F
+import java.util.C
+import java.util.HashM
+import java.util.L
+import java.util.S
+import android.app.A
+import android.app.AlertD
+import android.app.AlertDialog.B
+import android.app.DatePickerD
+import android.app.D
+import android.app.ProgressD
+import android.app.TimePickerD
+import android.bluetooth.BluetoothA
+import android.bluetooth.BluetoothD
+import android.content.ActivityNotFoundE
+import android.content.BroadcastR
+import android.content.ComponentN
+import android.content.C
+import android.content.DialogI
+import android.content.DialogInterface.OnCancelL
+import android.content.DialogInterface.OnKeyL
+import android.content.I
+import android.content.IntentF
+import android.content.pm.PackageI
+import android.media.AudioM
+import android.media.SoundP
+import android.net.U
+import android.os.B
+import android.os.E
+import android.os.H
+import android.os.Handler.C
+import android.os.L
+import android.os.M
+import android.provider.S
+import android.text.InputT
+import android.view.KeyE
+import android.view.LayoutI
+import android.view.V
+import android.view.View.OnClickL
+import android.view.View.OnFocusChangeL
+import android.view.View.OnLongClickL
+import android.view.inputmethod.InputMethodM
+import android.widget.B
+import android.widget.DateP
+import android.widget.EditT
+import android.widget.LinearL
+import android.widget.ScrollV
+import android.widget.TimeP
+import android.widget.T
+import com.mobile.entity.TW
+import com.mobile3.rchc.main.LoadingA
+import com.mobile3.rchc.main.ydjw_rwxzA
+import com.mobile3.rchc.main.ydjw_
+import com.mobile3.rchc2.R;
+import com.wb_ydjw.exception.CrashH
+public class KeyBoard2 {
+ View contextL
+ static A
+ Handler handlerZ;
+ public final static int CPH = 1;
* 身份证号
+ public final static int PID = 2;
+ public final static int TELNUM = 3;
+ public final static int ZJC = 4;
* 时间日期(年月日)
+ public final static int SJRQ1 = 5;
* 时间日期(时分秒)
+ public final static int SJRQ2 = 6;
+ public final static int NUMS = 7;
+ private View zjhmSelectionV
+ private LinearLayout selectI
+ // 驾驶证选择器子项所在的LINEARLAYOUT
+ private LinearLayout mainL
+ // 识别按钮所在的LinearLayout
+ private LinearLayout sfzKeboard_ln1;
+ // 驾驶证选择器中的EDITTEXT
+ public static EditText jszhSelectionE
+ // 驾驶证选择器退格
+ private Button backSpaceB
+ // 车牌号码选择器的VIEW
+ // 拍照识别
+ private Button pzsb_
+ // 读卡识别
+ private Button dksb_
+ // 读卡识别类
+ // private IC2ReadC
+ private LayoutI
+ // 驾驶证号选择器的值
+ private String[] NUM =
+ private String[] NUM1 = { &1&, &2&, &3&, &4&, &5&, &6&, &7&, &8&, &9&, &0&,
+ private String[] NUM2 = { &1&, &2&, &3&, &4&, &5&, &6&, &7&, &8&, &9&, &X&,
&0&, &.& };
+ public KeyBoard2(Activity context) {
activity =
+ public KeyBoard2(Activity context, Handler handler) {
activity =
this.handlerZ =
+ // boolean islongClickStart =
+ private View hphmSelectionV
+ // 准驾车型选择器VIEW
+ private View zjcxSelectionV
+ public static TWftcdeal TWFTDEAL;
+ private PrivateMsgR
+ String hsdksb = &com.seven.hsdksb&;
+ String privateMsg = &android.intent.action.privateMsg&;
+ String ar_dk = &cn.tchsoft.action.broadcast.idcard&;
+ String ar_zw = &com.xiazdong&;
+ String pz_cph = &cn.tchsoft.action.broadcast.idcardocr&;
+ String dksbAction = &&;
+ private String ht_dk = &cn.tchsoft.action.broadcast.idcard&;// 海棠设备广播
+ /* 号牌号码选择器 */
+ private static final String[] HMZ = { &1&, &2&, &3&, &4&, &5&, &6&, &7&,
&8&, &9&, &0&, &警&, &学&, &A&, &B&, &C&, &D&, &E&,/* &&, &&, */&F&,
&G&, &H&, &I&, &J&, &K&, &L&, &M&, &N&, &O&,/* &&, &&, */&P&, &Q&,
&R&, &S&, &T&, &U&, &V&, &W&, &X&, &Y&, &Z&, &-&, &.& };
+ // 准驾车型
+ private static String[] ZJCX = { &A1&, &A2&, &A3&, &B1&, &B2&, &B3&, &C1&,
&C2&, &C3&, &C4&, &D&, &E&, &F&, &M&, &N&, &P& };
+ // 编辑框
+ private EditText edit1;
+ // 退格键
+ private Button backspaceB
+ private Button xzqyInputB
+ private Button zmInputB
+ // private Button numInputB
+ private Button sysInputB
+ private LayoutI
+ private EditText hphmSelectionE
+ private LinearLayout xzqyL
+ private ScrollV
+ private LinearLayout pyL
+ private ScrollV
+ // private LinearLayout numL
+ // private ScrollV
+ private InputMethodM
+ public static final String MOBILE_ZD = &com.mobile.zd&;
+ public static final int REQ_MOBILE_ZD = 1;
+ ProgressDialog mProgressD
+ String tempxml = &&;
+ String result = &&;
+ public String picstr = &&;
+ int splitN = 0;
+ private B
+ boolean focusflag = // 默认为true 第一次能进入
+ // 输入法选择
+ private LinearLayout inputSelectionL
+ private S
+ public String HttpUrl = HttpConfig.URL + &Mobile/down/books/&;
+ private final static String RELEASE_DIR = Environment
.getExternalStorageDirectory() + &/YdqwHD/Apk/&;
+ public AlertDialog pzsbAd;
+ EditText inputEt;
+ public Button dksbB
+ // 读卡返回缓存,不然会多次返回
+ int indCou = 0;
* 创建软键盘
+ public void createSoftKeyboard(final int type, final EditText input) {
// 重制数据
indCou = 0;
if (type == KeyBoard2.PID) {
NUM = NUM2;
NUM = NUM1;
if (type == KeyBoard2.TELNUM || type == KeyBoard2.PID
|| type == KeyBoard2.NUMS) {
jszhSelectionInit();
// 只有身份证输入才显示读卡识别,拍照识别
if (type == KeyBoard2.PID) {
sfzKeboard_ln1.setVisibility(View.VISIBLE);
sfzKeboard_ln1.setVisibility(View.GONE);
jszhSelectionEdit.setText(input.getText().toString());
jszhSelectionEdit.setSelection(jszhSelectionEdit.length());
// final AlertDialog builder = new
// Builder(activity).setView(zjhmSelectionView).show();
contextLyout = zjhmSelectionV
pzsbAd = new KeyBoardDialog(activity, R.style.dialog);
// builder.setView(zjhmSelectionView);
pzsbAd.setCanceledOnTouchOutside(false);
pzsbAd.show();
pzsbAd.hide();
zjhmSelectionView.findViewById(R.id.done_keyboard)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (type == KeyBoard2.PID) {
// TODO Auto-generated method stub
// showDialog(PROGRESS_SHOW);
String sfz_text = jszhSelectionEdit
.getText().toString().trim();
// sfz_text=&180356&;
if (!sfz_text.equals(&&)) {
if (sfz_text.length() == 15) {
sfzh = sfz_
if (!StringSfzRegex
.isValidate18Idcard(sfzh)) {
Toast.makeText(activity,
&身份证输入不正确&, 1000)
AlertDialog dialog = new AlertDialog.Builder(
.setTitle(&提示&)
.setMessage(
&是否转为18位身份证号?&)
.setPositiveButton(
new AlertDialog.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
// Auto-generated
sfzh = StringSfzRegex
.convertIdcarBy15bit(sfzh);
if (StringSfzRegex
.isValidate18Idcard(sfzh)) {
input.setText(sfzh);
input.setSelection(0);
pzsbAd.cancel();
playSE(&sound&);
Toast.makeText(
&身份证输入不正确&,
Toast.LENGTH_LONG)
playSE(&sound&);
} catch (Exception e) {
.LongToast(
&出错了:&
+ e.getMessage());
.setNegativeButton(
new AlertDialog.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
// Auto-generated
input.setText(sfzh);
input.setSelection(0);
pzsbAd.cancel();
playSE(&sound&);
}).create();
dialog.show();
String[] arg = { sfz_text };
// 17位加权因子,与身份证号前17位依次相乘。
int w[] = { 7, 9, 10, 5, 8, 4,
2, 1, 6, 3, 7, 9, 10,
5, 8, 4, 2 };
int sum = 0;// 保存级数和
for (int i = 0; i & arg[0]
.length() - 1; i++) {
sum += new Integer(
arg[0].substring(
} catch (Exception e) {
Toast.makeText(activity,
&身份证输入不正确&,
Toast.LENGTH_LONG)
playSE(&sound&);
// closeDialog();
* 校验结果,上一步计算得出的结果与11取模,
* 得到的结果相对应的字符就是身份证最后一位
* ,也就是校验位。例如:0对应下面数组第一个元素,
* 以此类推。
String sums[] = { &1&, &0&,
&X&, &9&, &8&, &7&,
&6&, &5&, &4&, &3&, &2& };
if (sums[(sum % 11)].equals(arg[0].substring(
arg[0].length() - 1,
arg[0].length()))) {// 与身份证最后一位比较
input.setText(jszhSelectionEdit
.getText()
.toString());
input.setSelection(jszhSelectionEdit
.getSelectionEnd());
pzsbAd.cancel();
playSE(&sound&);
Toast.makeText(activity,
&身份证输入不正确&,
Toast.LENGTH_LONG)
playSE(&sound&);
// closeDialog();
Toast.makeText(activity, &请输入身份证号&,
Toast.LENGTH_LONG).show();
// closeDialog();
input.setText(jszhSelectionEdit
.getText().toString());
input.setSelection(jszhSelectionEdit
.getSelectionEnd());
pzsbAd.cancel();
playSE(&sound&);
} else if (type == KeyBoard2.TELNUM) {
String phone = jszhSelectionEdit
.getText().toString();
if (!StringSfzRegex.isPhoneNum(phone)
&& StringUtil.isNotEmpty(phone)) {
ToastUtil.LongToast(activity,
&请输入正确的手机号码&);
input.setText(jszhSelectionEdit
.getText().toString());
input.setSelection(jszhSelectionEdit
.getSelectionEnd());
pzsbAd.cancel();
} else if (type == KeyBoard2.NUMS) {
String phone = jszhSelectionEdit
.getText().toString();
input.setText(jszhSelectionEdit
.getText().toString());
input.setSelection(jszhSelectionEdit
.getSelectionEnd());
pzsbAd.cancel();
} catch (Exception e) {
ToastUtil.LongToast(activity,
&KeyBoard361出错了:& + e.getMessage());
e.printStackTrace();
zjhmSelectionView.findViewById(R.id.cancel_keyboard)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
pzsbAd.cancel();
playSE(&sound&);
focusflag =
// 读卡识别
dksbButton = (Button) zjhmSelectionView
.findViewById(R.id.dksb_keyboard);
dksbButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// if (handler != null) {
// // 开启读卡功能
// new IC2ReadCard2(activity, handler);
// } catch (Exception e) {
// e.printStackTrace();
// ToastUtil.LongToast(activity,
// &ERROR:(KeyBoard_IC2ReadCard2:620:&
// + e.getMessage());
// CrashHandler.crashInfoToService(e);
String phone = &&;
* String fileN = &IdCard_H7-1.2.apk&;//海棠设备安装包
* String appN =
* &com.tchsoft.plugins&;//海棠设备读卡apk项目包名 String
* actname = &com.tchsoft.plugins.IdReadActivity&
* ;//海棠设备apk
String fileN = &&;// 海棠设备安装包
String appN = &&;// 海棠设备读卡apk项目包名
String actname = &&;// 海棠设备apk
boolean flag =
for (int i = 0; i & ConstString.dtDk.getRowCount(); i++) {
phone = ConstString.dtDk.getString(i,
&PHONEMODEL&);
fileN = ConstString.dtDk.getString(i,
&FILENAME&);
appN = ConstString.dtDk.getString(i, &APPNAME&);
actname = ConstString.dtDk.getString(i,
&activity&);
if (AppConfig.PHONE_MODEL.equals(phone)) {
if (flag == true) {
// 判断是否安装
appN = &com.tchsoft.plugins&;
actname = &com.tchsoft.plugins.IdReadActivity&;
if (checkPrograme(appN)) {
Intent intent = new Intent();
ComponentName comp = new ComponentName(
appN, actname);
intent.setComponent(comp);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
dksbAction = ht_
addService();
final String na = fileN;
Builder builder = new Builder(activity);
builder.setTitle(&提示&);
builder.setMessage(&读卡程序未安装,是否下载并安装!安装完后请再次点击读卡识别!&);
builder.setPositiveButton(
new android.content.DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
Message msg2 = new Message();
msg2.what = 111;
handler.sendMessage(msg2);
// h.sendMessage(msg2);
setProsess().show();
builder.setNegativeButton(
new android.content.DialogInterface.OnClickListener() {
public void onClick(
DialogInterface arg0,
int arg1) {
builder.create();
builder.show();
// // 自动解压安装
// String fileName =
// Environment.getExternalStorageDirectory()
// + &/YdqwHD/dictionary/& + fileN;
// Intent intent2 = new
// Intent(Intent.ACTION_VIEW);
// intent2.setDataAndType(Uri.fromFile(new
// File(fileName)),
// &application/vnd.android.package-archive&);
// activity.startActivity(intent2);
ToastUtil.LongToast(activity,
&该设备不是读卡设备,无法开启读卡!&);
// 蓝牙读卡(华视,
getBluetooth();
// 查看蓝牙状态
// if(getBluetooth()){
// // 华视读卡
// Intent intent = new Intent();
// intent.setAction(&android.intent.action.START_DKSBSERVICE&);
// activity.stopService(intent);
// activity.startService(intent);
// dksbAction =
// CVR-100B
// // 华视读卡器100B安卓机(未集成代码)
// builder.cancel();
// ComponentName componetName = new
// ComponentName(
// // 这个是另外一个应用程序的包名
// &com.cvr100.android&,
// // 这个参数是要启动的Activity
// &com.cvr100.android.Cvr100bActivity&);
// // Intent intent= new
// Intent(&chroya.foo&);
// Intent intent = new Intent();
// // 我们给他添加一个参数表示从apk1传过去的
// Bundle bundle = new Bundle();
// intent.putExtras(bundle);
// intent.setComponent(componetName);
// activity.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
CrashHandler.saveCrashInfoToFile(e);
} else if (type == KeyBoard2.CPH) {
lif = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
hphmSelectionView = lif.inflate(R.layout.selection1, null);
hphmSelectionInit(input);
contextLyout = hphmSelectionV
// final AlertDialog builder = new
// Builder(activity).setView(hphmSelectionView).show();
final AlertDialog builder = new KeyBoardDialog(activity,
R.style.dialog);
builder.setCanceledOnTouchOutside(false);
builder.show();
hphmSelectionView.findViewById(R.id.done_keyboard1)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
input.setText(hphmSelectionEdit.getText()
.toString());
input.setSelection(hphmSelectionEdit
.getSelectionEnd());
builder.cancel();
playSE(&sound&);
hphmSelectionView.findViewById(R.id.cancel_keyboard1)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
builder.cancel();
closedService();
playSE(&sound&);
focusflag =
sysInputBtn = (Button) hphmSelectionView
.findViewById(R.id.sysinput);
sysInputBtn.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
builder.cancel();// 关闭输入面板
// 设置输入法显示时则隐藏,隐藏时则显示
// imm.toggleSoftInput(0,
// InputMethodManager.HIDE_NOT_ALWAYS);
// 强制设置输入法隐藏
// imm.hideSoftInputFromWindow(inputa.getWindowToken(),
// InputMethodManager.HIDE_NOT_ALWAYS);
// 强制设置输入法显示
imm.showSoftInput((View) input,
InputMethodManager.SHOW_IMPLICIT);
} else if (type == KeyBoard2.ZJC) {
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
zjcxSelectionView = inflater.inflate(R.layout.selection2, null);
edit1 = (EditText) zjcxSelectionView.findViewById(R.id.edit1);
edit1.setInputType(InputType.TYPE_NULL);
inputSelectionLinear = (LinearLayout) zjcxSelectionView
.findViewById(R.id.select_input);
// 就一项则不显示输入法选择项
inputSelectionLinear.setVisibility(View.GONE);
mainLinear = (LinearLayout) zjcxSelectionView
.findViewById(R.id.mainlinear);
backspaceBtn = (Button) zjcxSelectionView
.findViewById(R.id.backspace);
backspaceBtn.setOnClickListener(backZJCClickListener);
ActivityUtil.addSelectionBtn(zjcxSelectionView.getContext(),
mainLinear, ZJCX, 4, onItemClickListener);
contextLyout = zjcxSelectionV
// final AlertDialog builder = new
// Builder(activity).setView(zjcxSelectionView).show();
final AlertDialog builder = new KeyBoardDialog(activity,
R.style.dialog);
builder.setCanceledOnTouchOutside(false);
builder.show();
zjcxSelectionView.findViewById(R.id.done_keyboard)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
input.setText(edit1.getText().toString());
builder.cancel();
playSE(&sound&);
zjcxSelectionView.findViewById(R.id.cancel_keyboard)
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
builder.cancel();
playSE(&sound&);
focusflag =
} else if (type == KeyBoard2.SJRQ1) {
Calendar c = Calendar.getInstance();
Dialog dialog = new DatePickerDialog(activity,
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker dp, int year,
int month, int dayOfMonth) {
// et.setText(&您选择了:& + year + &年& + (month+1) +
// + dayOfMonth + &日&);
input.setText(year + &-& + (month + 1) + &-&
+ dayOfMonth);
}, c.get(Calendar.YEAR), // 传入年份
c.get(Calendar.MONTH), // 传入月份
c.get(Calendar.DAY_OF_MONTH) // 传入天数
dialog.show();
} else if (type == KeyBoard2.SJRQ2) {
Calendar c = Calendar.getInstance();
Dialog dialog = new TimePickerDialog(activity,
new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view,
int hourOfDay, int minute) {
// et.setText(&您选择了:&+hourOfDay+&时&+minute+&分&);
input.setText(hourOfDay + &:& + minute + &:&
}, c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE),
dialog.show();
} catch (Exception e) {
e.printStackTrace();
CrashHandler.saveCrashInfoToFile(e);
+ // ====================================================================================
+ // 准驾车选择器
+ // 子项按钮点击监听
+ OnClickListener onItemClickListener = new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
int index = edit1.getSelectionStart();
System.out.println(&index=& + index);
Button temp = (Button)
String str = edit1.getText().toString();
String strStart = str.substring(0, index);
String strEnd = str.substring(index, str.length());
index = index + temp.getText().toString().length();
String finalStr = strStart + temp.getText().toString() + strE
edit1.setText(finalStr);
edit1.setSelection(index);
playSE(&sound&);
+ // 退格监听
+ OnClickListener backZJCClickListener = new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
* String str1 = edit1.getText().toString(); String str2 = &&; if
* (str1.length() &= 1) { str2 = str1.substring(0, str1.length() -
* 1); } edit1.setText(str2);
int index = edit1.getSelectionStart();
System.out.println(&index=& + index);
String str1 = edit1.getText().toString();
String strStart = str1.substring(0, index);
String strEnd = str1.substring(index, str1.length());
String str2 = &&;
if (strStart.length() &= 1) {
str2 = strStart.substring(0, strStart.length() - 1);
String finalStr = str2 + strE
edit1.setText(finalStr);
edit1.setSelection(index);
playSE(&sound&);
+ public Dialog setProsess() {
// 显示对话框
mDialog = new ProgressDialog(activity);
// mDialog.setCancelable(false);
mDialog.setCanceledOnTouchOutside(false);
mDialog.setOnCancelListener(new OnCancelListener() {
public void onCancel(DialogInterface dialog) {
// TODO Auto-generated method stub
if (UpdateService.progress == 404) {
handler.sendEmptyMessage(-4);
handler.sendEmptyMessage(-2);
mDialog.setMax(100);
mDialog.setProgress(10);
mDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mDialog.setTitle(R.string.progress_title);
mDialog.setMessage(&正在下载...&);
mDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode,
KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mDialog.isShowing()) {
// 关闭下载线程
file.cancel =
System.out.println(&下载取消&);
Toast.makeText(activity, &下载取消!&, Toast.LENGTH_SHORT)
+ // =======================================================================================================
+ // 身份证手机号
+ public void jszhSelectionInit() {
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
zjhmSelectionView = inflater.inflate(R.layout.selection2, null);
selectInput = (LinearLayout) zjhmSelectionView
.findViewById(R.id.select_input);
mainLinear = (LinearLayout) zjhmSelectionView
.findViewById(R.id.mainlinear);
jszhSelectionEdit = (EditText) zjhmSelectionView
.findViewById(R.id.edit1);
sfzKeboard_ln1 = (LinearLayout) zjhmSelectionView
.findViewById(R.id.sfzKeboard_ln1);
pzsb_keyboard = (Button) zjhmSelectionView
.findViewById(R.id.pzsb_keyboard);
// 拍照识别
pzsb_keyboard.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// OCR(v);
Intent intent = new Intent(activity, ydjw_rxbd.class);
activity.startActivity(intent);
dksb_keyboard = (Button) zjhmSelectionView
.findViewById(R.id.dksb_keyboard);
// read = IC2ReadCard.getRead(activity);
// if (ConstString.isReadCard == true) {
// dksb_keyboard.setText(&关闭读卡器&);
// } else {
// dksb_keyboard.setText(&读卡识别&);
// dksb_keyboard.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// // TODO Auto-generated method stub
// // if (ConstString.isReadCard == true && read != null) {
// // read.stop();
// // ConstString.isReadCard =
// // Toast.makeText(activity, &读卡器功能已关闭!&, 1)
// // .show();
// // dksb_keyboard.setText(&开启读卡器&);
// // } else if (AppConfig.PHONE_MODEL.equals(&A9&)) {// 国腾读卡器
// // read.start();
// // ConstString.isReadCard =
// // Toast.makeText(activity, &读卡器功能已开启!&, 1)
// // .show();
// // dksb_keyboard.setText(&关闭读卡器&);
// // } else {
// // ToastUtil.ShortToast(activity, &无读卡器&);
// // Intent intent = new
// // Intent(activity,com.mobile.guoteng.IC2ReadCard.class);
// // activity.startActivity(intent);
// if (handler != null) {
// // 开启读卡功能
// new IC2ReadCard2(activity, handler);
// } catch (Exception e) {
// e.printStackTrace();
// ToastUtil.LongToast(activity,
// &ERROR:(KeyBoard_IC2ReadCard2:620:&
// + e.getMessage());
// CrashHandler.crashInfoToService(e);
// jszhSelectionEdit.setInputType(InputType.TYPE_NULL);
jszhSelectionEdit.setCursorVisible(true);
// jszhSelectionEdit.setText(sfz.getText().toString());}

我要回帖

更多关于 php 随机数 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信