List of usage examples for android.util Log i
public static int i(String tag, String msg)
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void setMetering(Camera.Parameters parameters) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (parameters.getMaxNumMeteringAreas() > 0) { Log.i(TAG, "Old metering areas: " + parameters.getMeteringAreas()); List<Camera.Area> middleArea = buildMiddleArea(AREA_PER_1000); Log.i(TAG, "Setting metering area to : " + toString(middleArea)); parameters.setMeteringAreas(middleArea); } else {//from ww w .j av a 2 s . c o m Log.i(TAG, "Device does not support metering areas"); } } else { Log.i(TAG, "Device does not support metering areas"); } }
From source file:com.cssweb.android.connect.ConnPool.java
public static JSONObject sendReq(String funcname, String funcno, String reqbuf) throws JSONException { StringBuffer sb = new StringBuffer(); sb.append(TradeUtil.getGlobalRequest(funcname, funcno)); sb.append(reqbuf);/* w w w. j av a 2 s . co m*/ sb.append("&ram=" + Math.random()); String sbStr = sb.toString(); if ("190101".equals(funcno) || "203113".equals(funcno) || "203111".equals(funcno) || "203526".equals(funcno) || "203119".equals(funcno) || "202010".equals(funcno) || "202012".equals(funcno)) { sbStr = sbStr.replace("isSafe=0", "isSafe=1"); } Log.i("==", sbStr); String req = ""; try { req = new String(Base64.encode(sbStr.getBytes("gb2312"))); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } req = TradeUtil.getResult(req); Log.i(">>>>>url>>>>>>>", getURL() + req); return Conn.tradeReq(getURL() + req); }
From source file:Main.java
public static void getListViewSize(GridView myListView) { ListAdapter myListAdapter = myListView.getAdapter(); if (myListAdapter == null) { //do nothing return null return;// w w w.j ava2 s .com } //set listAdapter in loop for getting final size int totalHeight = 0; int listval = myListAdapter.getCount(); if (listval % 3 == 0) { listval = myListAdapter.getCount() / 3; } else { listval = myListAdapter.getCount() / 3 + 1; } for (int size = 0; size < listval; size++) { View listItem = myListAdapter.getView(size, null, myListView); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } System.out.println("Height " + totalHeight + " " + myListAdapter.getCount()); //setting listview item in adapter ViewGroup.LayoutParams params = myListView.getLayoutParams(); params.height = totalHeight + ((myListView.getVerticalSpacing() / 3) * (myListAdapter.getCount() - 1)); myListView.setLayoutParams(params); // print height of adapter on log Log.i("height of listItem:", String.valueOf(totalHeight)); }
From source file:Main.java
public static String isVoiceSearchServiceExist(Context context) { if (DEBUG)//w w w . j av a 2 s .com Log.i(TAG, "isVoiceSearchServiceExist()"); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList(); //boolean isVoiceSearchServiceEnabled = false; for (int i = 0; i < mInputMethodProperties.size(); i++) { InputMethodInfo imi = mInputMethodProperties.get(i); if (DEBUG) Log.i(TAG, "enabled IM " + i + ":" + imi.getId()); if (imi.getId().equals("com.google.android.voicesearch/.ime.VoiceInputMethodService")) { return "com.google.android.voicesearch/.ime.VoiceInputMethodService"; } else if (imi.getId().equals( "com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService")) { return "com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService"; } } return null; }
From source file:com.ibm.mil.readyapps.telco.analytics.OperationalAnalyticsReporter.java
/** * planChangeAccepted() sends an Operational Analytics log anytime a user accepts a plan change. * * @param planChangeType the type of plan change that a user has accepted (ie baseplan * increase, baseplan decrease, addon, etc) * @param amount the cost amount of the plan change. *//*from www . j a v a 2 s .c om*/ public static void planChangeAccepted(@AnalyticsCnsts.PlanChange String planChangeType, double amount) { // Create a custom activity with a log message Date date = new Date(); Timestamp curTime = new Timestamp(date.getTime()); String json = gson.toJson(new AnalyticsPlanChange(planChangeType, amount, curTime), AnalyticsPlanChange.class); JSONObject jsonObject = null; try { jsonObject = new JSONObject(json); jsonObject.put("_activity", "planChanged"); Log.i("TEST", "JSON AFTER ACTIVITY " + jsonObject.toString()); WLAnalytics.log("Plan change accepted by a user", jsonObject); //async } catch (JSONException e) { e.printStackTrace(); } }
From source file:Main.java
public static String getVoiceSearchIMId(Context context) { ComponentName voiceInputComponent = new ComponentName("com.google.android.voicesearch", "com.google.android.voicesearch.ime.VoceInputMethdServce"); if (DEBUG)//from w w w. j av a2 s . c o m Log.i(TAG, "getVoiceSearchIMId(), Comonent name = " + voiceInputComponent.flattenToString() + ", id = " + voiceInputComponent.flattenToShortString()); return voiceInputComponent.flattenToShortString(); }
From source file:Main.java
@SuppressLint("NewApi") public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) { List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange(); Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges)); if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) { int[] suitableFPSRange = null; for (int[] fpsRange : supportedPreviewFpsRanges) { int thisMin = fpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX]; int thisMax = fpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]; if (thisMin >= minFPS * 1000 && thisMax <= maxFPS * 1000) { suitableFPSRange = fpsRange; break; }/*w w w. j a va 2s . com*/ } if (suitableFPSRange == null) { Log.i(TAG, "No suitable FPS range?"); } else { int[] currentFpsRange = new int[2]; parameters.getPreviewFpsRange(currentFpsRange); if (Arrays.equals(currentFpsRange, suitableFPSRange)) { Log.i(TAG, "FPS range already set to " + Arrays.toString(suitableFPSRange)); } else { Log.i(TAG, "Setting FPS range to " + Arrays.toString(suitableFPSRange)); parameters.setPreviewFpsRange(suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX], suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]); } } } }
From source file:Main.java
public static void logInfo(String message) { if (DEBUG) { Log.i(TAG, message); } }
From source file:com.codebutler.rsp.Util.java
public static String getURL(URL url, String password) throws Exception { Log.i("Util.getURL", url.toString()); DefaultHttpClient client = new DefaultHttpClient(); if (password != null && password.length() > 0) { UsernamePasswordCredentials creds; creds = new UsernamePasswordCredentials("user", password); client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds); }//from w w w . jav a 2s . c o m HttpGet method = new HttpGet(url.toURI()); BasicResponseHandler responseHandler = new BasicResponseHandler(); return client.execute(method, responseHandler); }
From source file:Main.java
public static boolean getkeepaliveinfo() { String baseUrl = "http://10.6.8.2/cgi-bin/keeplive?"; try {/*from w ww . j a v a 2s .c om*/ HttpGet getMethod = new HttpGet(baseUrl); getMethod.addHeader("Accept", "*/*"); //getMethod.addHeader("Accept-Language", "zh-cn"); //getMethod.addHeader("Referer", "http://202.117.2.41/index.html"); //getMethod.addHeader("Content-Type", "application/x-www-form-urlencoded"); //getMethod.addHeader("Accept-Encoding", "gzip, deflate"); //getMethod.addHeader("User-Agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"); getMethod.addHeader("Host", "10.6.8.2"); //getMethod.addHeader("DNT", "1"); HttpClient httpClient = new DefaultHttpClient(); HttpResponse response = httpClient.execute(getMethod); Log.i(TAG, "Sending message....."); HttpEntity httpEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() == 200) { String message = EntityUtils.toString(httpEntity); if (httpEntity == null || message.compareTo("error") == 0) { Log.i(TAG, "Get keepalive info failed!!!message=" + message); return false; } else { Log.i(TAG, "Get keepalive info succeed!!!message=" + message); return true; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Log.i(TAG, "Get keepalive info failed!!!"); return false; }