摘要: 原文地址:http://www.fengfly.com/plus/view-209437-1.html要用到下面两个类:DeviceAdminReceiver设备管理组件。这个类提供了一个方便解释由系统发出的意图的动作。你的设备管理应用程序必须包含一个DeviceAdminReceiver的子类。本... 阅读全文
posted @ 2014-05-26 10:26 Gsdimz 阅读(1356) 评论(0) 推荐(1) 编辑
摘要: public class StreamTools { public static String readFromStream(InputStream is) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = is.read(buffer)) != -1) { baos.write... 阅读全文
posted @ 2013-06-12 00:21 Gsdimz 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 项目用到加载大图片,app老是出现OOM异常,总结了几点经验,供参考。1、手动干涉dalvik的堆内存处理效率:1 private final static float TARGET_HEAP_UTILIZATION = 0.75f;2 //for same activity3 public void onCreate()4 {5 …………6 VMRuntime.getRuntime().setTargetHeapUtilization(TARGET_HEAP_UTILIZATION);7 …………8 }2、手动指定Android堆大小:1 private final static int C 阅读全文
posted @ 2013-05-21 00:31 Gsdimz 阅读(499) 评论(0) 推荐(0) 编辑
摘要: package com.heaven.shopping.engine.impl.impl;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import org.json.JSONException;import org.json.JSONObject;import com.alibaba.fastjson.JSON;import com.heaven.shopping.ConstantValue;import com.heaven.shopping.be 阅读全文
posted @ 2013-05-21 00:13 Gsdimz 阅读(192) 评论(0) 推荐(0) 编辑
摘要: package com.ithm.lottery16.net;import java.io.InputStream;import org.apache.commons.lang3.StringUtils;import org.apache.http.HttpHost;import org.apache.http.HttpRequest;import org.apache.http.HttpResponse;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpGet;import o 阅读全文
posted @ 2013-05-21 00:10 Gsdimz 阅读(203) 评论(0) 推荐(0) 编辑
摘要: public class StartupReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent startupintent = new Intent(context,StrongTracks.class); startupintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startupintent);... 阅读全文
posted @ 2013-05-20 16:05 Gsdimz 阅读(520) 评论(1) 推荐(1) 编辑
摘要: ContentValues values = new ContentValues();values.put(NAME, "CMCC cmwap");values.put(APN, "cmwap");values.put(PROXY, "10.0.0.172");values.put(PORT, "80");values.put(MMSPROXY, "");values.put(MMSPORT, "");values.put(USER, "");values 阅读全文
posted @ 2013-05-20 16:04 Gsdimz 阅读(172) 评论(0) 推荐(0) 编辑
摘要: public void setBrightness(int level) { ContentResolver cr = getContentResolver(); Settings.System.putInt(cr, "screen_brightness", level); Window window = getWindow(); LayoutParams attributes = window.getAttributes(); float flevel = level; attributes.screenBrightness = flevel / 255; getWind 阅读全文
posted @ 2013-05-20 16:03 Gsdimz 阅读(145) 评论(0) 推荐(0) 编辑
摘要: (1) BitMap to inputStream: ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); InputStream isBm = new ByteArrayInputStream(baos .toByteArray()); (2)BitMap to byte[]: Bitmap defaultIcon = BitmapFactory.decodeStream(in); ByteArray... 阅读全文
posted @ 2013-05-20 16:01 Gsdimz 阅读(130) 评论(0) 推荐(0) 编辑
摘要: /** 获取存储卡路径 */ File sdcardDir=Environment.getExternalStorageDirectory(); /** StatFs 看文件系统空间使用情况 */ StatFs statFs=new StatFs(sdcardDir.getPath()); /** Block 的 size*/ Long blockSize=statFs.getBlockSize(); /** 总 Block 数量 */ Long totalBlocks=statFs.getBlockCount(); /** 已使用的 Block 数量 */ Long availableBlo 阅读全文
posted @ 2013-05-20 15:59 Gsdimz 阅读(157) 评论(0) 推荐(0) 编辑