List of usage examples for android.util Log i
public static int i(String tag, String msg)
From source file:hongik.android.project.best.StoreReviewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_storereview); license = getIntent().getStringExtra("LICENSE"); reviewTable = (TableLayout) findViewById(R.id.storereview_table); try {// www . j av a2s . c o m drawTable(); } catch (Exception ex) { Log.i("StoreMenu", ex.toString()); } }
From source file:net.kayateia.lifestream.Network.java
static public synchronized String DoLogin(Context context, String userText, String passText) { Settings settings = new Settings(context); // See if we have a GCM ID first. String gcmId = settings.getGcmId(); if (gcmId.equals("")) gcmId = GCMRegistrar.getRegistrationId(context); if (gcmId.equals("")) { // Request one. We'll pick up its contents and re-register later. GCMRegistrar.register(context, GCMIntentService.GCM_SENDER_ID); } else {/* ww w . java 2 s . co m*/ String oldId = settings.getGcmId(); if (!oldId.equals("") && !gcmId.equals(oldId)) { Log.w(LOG_TAG, "GCMRegistrar returned a different ID (" + gcmId + ") than we thought we had (" + oldId + ")"); } } Log.i(LOG_TAG, "Our GCM ID for user login is: " + gcmId); // Do we have an auth ID? String authId = settings.getAuthToken(); if (authId.equals("")) { authId = userText + "+" + Settings.GetAndroidID(context); } // Now contact the LifeStream server. HashMap<String, String> parameters = new HashMap<String, String>(); parameters.put("login", userText); parameters.put("pass", passText); parameters.put("gcm", gcmId); parameters.put("auth", authId); String resultText = ""; try { String baseUrl = Settings.GetBaseUrl(); resultText = HttpMultipartUpload.DownloadString(new URL(baseUrl + "login.php"), parameters, context); // Crack the JSON. If we can't parse it, we fail below. If we // parse it but get a 'message', we failed too. Otherwise we // should have some login info. JSONObject result = new JSONObject(resultText); String message = result.optString("message"); if (message != null && message.length() > 0) { Log.e(LOG_TAG, "Couldn't log in: " + message); return null; } settings.setUserName(userText); settings.setPassword(passText); settings.setGcmId(gcmId); settings.setAuthToken(authId); settings.commit(); return result.optString("name"); } catch (IOException e) { Log.e(LOG_TAG, "Couldn't log in: " + e); return null; } catch (JSONException e) { Log.e(LOG_TAG, "Couldn't parse login response: " + resultText); return null; } }
From source file:com.google.android.gcm.demo.app.utils.ServerUtilities.java
/** * Register this account/device pair within the server. * * @return whether the registration succeeded or not. *///from ww w . j a v a 2 s.co m public static boolean register(final Context context, final String registrationId) { Log.i(TAG, "registering device (registrationId = " + registrationId + ")"); long backoff = BACKOFF_MILLI_SECONDS + random.nextInt(1000); // Once GCM returns a registration id, we need to register it in the // demo server. As the server might be down, we will retry it a couple // times. for (int i = 1; i <= MAX_ATTEMPTS; i++) { Log.d(TAG, "Attempt #" + i + " to register"); try { displayMessage(context, context.getString(R.string.server_registering, i, MAX_ATTEMPTS)); // TODO check connection before call HttpResponse httpResponse = doHttpPut(REGISTRATION_URL, buildRegistationIdRequest(registrationId)); if (httpResponse.getStatusLine().getStatusCode() != 200) { if (!sleep(backoff)) return false; } else { GCMRegistrar.setRegisteredOnServer(context, true); displayMessage(context, context.getString(R.string.server_registered)); return true; } } catch (Exception e) { // Here we are simplifying and retrying on any error; in a real // application, it should retry only on unrecoverable errors // (like HTTP error code 503). Log.e(TAG, "Failed to register on attempt " + i, e); if (i == MAX_ATTEMPTS) { break; } if (!sleep(backoff)) return false; // increase backoff exponentially backoff *= 2; } } displayMessage(context, context.getString(R.string.server_register_error, MAX_ATTEMPTS)); return false; }
From source file:Main.java
/** * Logs provided logText in provided tag at given logLevel (like, android.util.Log.DEBUG) * @param logLevel int VERBOSE, DEBUG, INFO, WARN, ERROR * @param tag String/*from ww w.jav a 2 s .c om*/ * @param logText String */ public static void log(int logLevel, String tag, String logText) { switch (logLevel) { case Log.VERBOSE: Log.v(tag, logText); break; case Log.DEBUG: Log.d(tag, logText); break; case Log.INFO: Log.i(tag, logText); break; case Log.WARN: Log.w(tag, logText); break; case Log.ERROR: Log.e(tag, logText); break; } }
From source file:com.elkriefy.android.apps.authenticationexample.AuthenticationExample.java
public void inject(Object object) { if (mObjectGraph == null) { // This usually happens during tests. Log.i(TAG, "Object graph is not initialized."); return;// ww w . java 2 s. c o m } mObjectGraph.inject(object); }
From source file:com.cssweb.android.service.AutoLoadAllStock.java
public void onStart(Intent intent, int startId) { Log.i("TAG", "Services onStart"); super.onStart(intent, startId); new Thread() {//?1???iintent public void run() { while (!isStop) { int end = Integer.parseInt(DateTool.getLoadAllStockEndTime()); int star = Integer.parseInt(DateTool.getLoadAllStockStarTime()); int now = Integer.parseInt(DateTool.getLocalCurrentDate()); Log.i("==BroadcastReceiver==", star + ">>>>>>" + now + ">>>>>>" + end + ">>>>>>>"); if (now <= end && now >= star) { if (jsonObject == null) jsonObject = CssIniFile.loadStockData(AutoLoadAllStock.this, CssIniFile.GetFileName(CssIniFile.UserStockFile)); if (jsonObject != null) { try { JSONObject localData = new JSONObject(jsonObject); String locMd5code = localData.getString("md5code"); JSONObject jMD5 = ConnService.getStockFileMD5(); if (Utils.isHttpStatus(jMD5)) { String serMd5code = jMD5.getJSONObject("data").getString("allstock"); Log.i("==BroadcastReceiver==", "9:10??MD5?:" + locMd5code + ">>>>>>" + serMd5code); Log.i("==BroadcastReceiver==", "9:10??MD5?:" + locMd5code.equals(serMd5code)); if (!locMd5code.equals(serMd5code)) { //if(locMd5code.equals(serMd5code)) {//test //CssIniFile.DeletFilePath(CssIniFile.UserStockFile); JSONObject quoteData = ConnService.getAllStock(); StockInfo.allStock = quoteData; StockInfo.clearData(); StockInfo.initAllStock(quoteData); String tmp = quoteData.toString(); CssIniFile.saveAllStockData(AutoLoadAllStock.this, CssIniFile.UserStockFile, tmp); jsonObject = tmp; //ActivityUtil.IS_SAVE_LASTEST_STOCK = true; }//from ww w . j ava 2 s.c o m } } catch (JSONException e) { e.printStackTrace(); } } } try { sleep(1000 * 60); } catch (InterruptedException e) { e.printStackTrace(); } } } }.start(); }
From source file:Main.java
private static Bitmap readRoughScaledBitmap(InputStream is, float maxRatio) { Bitmap result;/*from www . j a v a2s.c om*/ // Create the bitmap from file BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = (int) maxRatio; result = BitmapFactory.decodeStream(is, null, options); if (result != null) { Log.i("Photo Editor", "Read Scaled Bitmap Result wtf: " + result.getWidth() + " " + result.getHeight()); Log.i("Photo Editor", "MaxRatio wtf: " + maxRatio); } return result; }
From source file:Main.java
private static Bitmap processBitmap(Bitmap bm) { float width = bm.getWidth(); float height = bm.getHeight(); int maxWidth = 150; int maxHeight = 150; float oldHeight; int oldWidth; float newWidth; float newHeight; float schnitt; Log.i("==============>", "width: " + width); Log.i("==============>", "height: " + height); newWidth = maxWidth;//from w w w . j ava2 s.c o m schnitt = newWidth / width; newHeight = (int) (schnitt * height); if (newHeight > maxHeight) { oldHeight = newHeight; oldWidth = (int) newWidth; newHeight = maxHeight; schnitt = newHeight / oldHeight; newWidth = schnitt * oldWidth; } Log.i("==============>", "New Width: " + newWidth); Log.i("==============>", "New Height: " + newHeight); bm = Bitmap.createScaledBitmap(bm, (int) newWidth, (int) newHeight, true); Log.i(I, "create scaled Bitmap successful"); return bm; }
From source file:Main.java
public static void setFocus(Camera.Parameters parameters, boolean autoFocus, boolean disableContinuous, boolean safeMode) { List<String> supportedFocusModes = parameters.getSupportedFocusModes(); String focusMode = null;/*from ww w. ja v a2 s . c o m*/ if (autoFocus) { if (safeMode || disableContinuous) { focusMode = findSettableValue("focus mode", supportedFocusModes, Camera.Parameters.FOCUS_MODE_AUTO); } else { focusMode = findSettableValue("focus mode", supportedFocusModes, Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE, Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO, Camera.Parameters.FOCUS_MODE_AUTO); } } // Maybe selected auto-focus but not available, so fall through here: if (!safeMode && focusMode == null) { focusMode = findSettableValue("focus mode", supportedFocusModes, Camera.Parameters.FOCUS_MODE_MACRO, Camera.Parameters.FOCUS_MODE_EDOF); } if (focusMode != null) { if (focusMode.equals(parameters.getFocusMode())) { Log.i(TAG, "Focus mode already set to " + focusMode); } else { parameters.setFocusMode(focusMode); } } }
From source file:com.bellman.bible.android.view.activity.search.SearchIndex.java
/** * Called when the activity is first created. *///from ww w .j a va2s . co m @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "Displaying SearchIndex view"); setContentView(R.layout.search_index); Log.d(TAG, "Finished displaying Search Index view"); }