随笔分类 - 工具类
摘要: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...
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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);...
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:(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...
阅读全文
摘要:/** 获取存储卡路径 */ 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
阅读全文
摘要:1、<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> 2、private String getLocalMacAddress() { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); return info.getMacAddress(); }
阅读全文
摘要:< activity android:name="MyActivity" android:configChanges="orientation|keyboardHidden"> public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATIO
阅读全文
摘要:Uri uri = data.getData();String[] proj = { MediaStore.Images.Media.DATA };Cursor actualimagecursor = managedQuery(uri,proj,null,null,null);int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);actualimagecursor.moveToFirst();String img_path = actualima
阅读全文
摘要:http://pan.baidu.com/share/link?shareid=106157&uk=3710762942
阅读全文
摘要:<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> private boolean getNetWorkStatus() { boolean netSataus = false; ConnectivityManager cwjManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); cwjManager.getActiveNetworkInfo();...
阅读全文
摘要:package com.heaven.shopping.net;import java.util.ArrayList;import java.util.List;import java.util.Map;import org.apache.commons.lang3.StringUtils;import org.apache.http.HttpEntity;import org.apache.http.HttpHost;import org.apache.http.HttpRequest;import org.apache.http.HttpResponse;import org.apache
阅读全文
浙公网安备 33010602011771号