List of usage examples for android.util Log e
public static int e(String tag, String msg)
From source file:Main.java
public static void log(String message) { Log.e(TAG, message); }
From source file:Main.java
public static void e(String tag, String msg) { if (DEBUG) { Log.e(tag, msg); } }
From source file:Main.java
public static int getRotationAngle(String photoPath) { ExifInterface ei = null;//from www .j ava 2 s . c o m try { ei = new ExifInterface(photoPath); } catch (IOException e) { Log.e(TAG, "Unexpected error occurred when getting rotation angle."); } int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: Log.d(TAG, "90 Degrees rotation needed"); return 90; case ExifInterface.ORIENTATION_ROTATE_180: Log.d(TAG, "180 Degrees rotation needed"); return 180; case ExifInterface.ORIENTATION_ROTATE_270: Log.d(TAG, "270 Degrees rotation needed"); return 270; case ExifInterface.ORIENTATION_NORMAL: default: Log.d(TAG, "0 Degrees rotation needed"); return 0; } }
From source file:Main.java
public static long getLongPreferences(Context context, String name) { try {/*w w w . j av a2s. c o m*/ return context.getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).getLong(name, 0); } catch (Exception e) { Log.e("datautils", e.getMessage()); remove(context, name); } return 0; }
From source file:Main.java
public static int indexOfBAIndex(byte[] data) { int index = 0; for (int i = 0; i < data.length; i++) { if (data[i] == (byte) 0xBA) { if (i < (data.length - 1)) { if (data[i + 1] == (byte) 0xBA) { index = i;/*from w ww . j a va 2 s . c o m*/ break; } } } } Log.e("BMSUtil", "contain the BA indexAt:" + index); return index; }
From source file:Main.java
public static void writeToFile(String path, String data) { try {// w w w .j ava 2 s . com OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(path)); outputStreamWriter.write(data); outputStreamWriter.close(); } catch (IOException e) { Log.e("Exception", "File write failed: " + e.toString()); } }
From source file:Main.java
public static byte[] decodeBitmapToBytes(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (bitmap != null) { bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); } else {/*from w w w. j a v a2 s .c o m*/ Log.e(TAG, "bitmap is null"); return null; } }
From source file:Main.java
public static int getLayoutIdFromName(Context context, String type, String name) { String layoutName = type + "_" + name.replaceAll("(.)(\\p{Lu})", "$1_$2").toLowerCase(); try {/*from w ww . j av a 2 s . c o m*/ return context.getResources().getIdentifier(layoutName, "layout", context.getPackageName()); } catch (Exception ex) { Log.e("Yintro", "Please create layout suggested name: " + layoutName); return -1; } }
From source file:Main.java
public static boolean move(float[] values, float[] preAccelerometerValues) { float difx = Math.abs(values[SensorManager.DATA_X]); float dify = Math.abs(values[SensorManager.DATA_Y]); float difz = Math.abs(values[SensorManager.DATA_Z]); Log.e("log.e val = ", " " + difx + " " + dify + " " + difz); float difx1 = Math.abs(preAccelerometerValues[SensorManager.DATA_X]); float dify1 = Math.abs(preAccelerometerValues[SensorManager.DATA_Y]); float difz1 = Math.abs(preAccelerometerValues[SensorManager.DATA_Z]); Log.e("log.e pre = ", " " + difx1 + " " + dify1 + " " + difz1); float difx2 = Math.abs(values[SensorManager.DATA_X] - preAccelerometerValues[SensorManager.DATA_X]); float dify2 = Math.abs(values[SensorManager.DATA_Y] - preAccelerometerValues[SensorManager.DATA_Y]); float difz2 = Math.abs(values[SensorManager.DATA_Z] - preAccelerometerValues[SensorManager.DATA_Z]); Log.e("log.e dif = ", " " + difx2 + " " + dify2 + " " + difz2); if (checkMove(values[SensorManager.DATA_X], preAccelerometerValues[SensorManager.DATA_X]) || checkMove(values[SensorManager.DATA_Y], preAccelerometerValues[SensorManager.DATA_Y]) || checkMove(values[SensorManager.DATA_Z], preAccelerometerValues[SensorManager.DATA_Z])) { return true; }//from w ww.j a v a2 s . com return false; }
From source file:Main.java
/** * Close a InputStream passed in.// w w w .ja va 2 s . co m * * @param stream - InputStream to be closed. */ public static void closeInputStream(InputStream stream, String tag) { if (stream != null) { try { stream.close(); } catch (IOException e) { Log.e(tag, "Exception occured when closing InputStream." + e); } } }