Example usage for android.util Log e

List of usage examples for android.util Log e

Introduction

In this page you can find the example usage for android.util Log e.

Prototype

public static int e(String tag, String msg) 

Source Link

Document

Send an #ERROR log message.

Usage

From source file:Main.java

/**
 * Take an ISO 8601 string and return a Date object.
 * On failure, returns null.//from w w  w . j a  va 2 s  . c o m
 */
public static Date getDateFromIso8601String(String s) {
    SimpleDateFormat df = new SimpleDateFormat(ISO_8601_FORMAT);
    try {
        return df.parse(s);
    } catch (ParseException e) {
        Log.e("DateUtilities", "Error parsing ISO 8601 date");
        return null;
    }
}

From source file:Main.java

public static Process changeBuildProperty(Context c, String propName, String newValue) {
    Process p = null;/*  w  w w. j a va 2s  .co m*/
    try {
        remountSystem(c);

        p = runSuCommandAsync(c, "busybox sed -i \"s/" + propName + "=.*/" + propName + "=" + newValue
                + "/g\" /system/build.prop ; ");
        p.waitFor();
    } catch (Exception d) {
        Log.e("Helper", "Failed to change build.prop. errcode:" + d.toString());
    }
    return p;
}

From source file:Main.java

public static String getSHA256(byte[] mydata) {
    try {/*from   www.j a  v  a  2 s  .  co m*/
        MessageDigest digest = java.security.MessageDigest.getInstance("SHA256");
        digest.update(mydata);
        return bytesToHex(digest.digest()).toLowerCase();
    } catch (NoSuchAlgorithmException e) {
        Log.e(TAG, "SHA hash exception: " + e.toString());
        return null;
    }
}

From source file:Main.java

public static Bitmap decodeSampleBitMapFromResource(Context context, int resId, int reqWidth, int reqHeight) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;/*from w w w . j  av a  2s. c om*/
    BitmapFactory.decodeResource(context.getResources(), resId, options);
    options = sampleBitmapOptions(context, options, reqWidth, reqHeight);
    Bitmap bm = BitmapFactory.decodeResource(context.getResources(), resId, options);
    Log.e("xxx", bm.getByteCount() + "");
    return bm;
}

From source file:Main.java

public static File bitmap2File(Bitmap bitmap, String filename) {
    String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
    OutputStream outStream = null;

    File file = new File(extStorageDirectory, filename + ".png");
    if (file.exists()) {
        file.delete();/*from  ww w  . j a  v a 2 s.c om*/
        file = new File(extStorageDirectory, filename + ".png");
        Log.e("file exist", "" + file + ",Bitmap= " + filename);
    }
    try {
        outStream = new FileOutputStream(file);
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream);
        outStream.flush();
        outStream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    Log.e("file", "" + file);
    return file;

}

From source file:Main.java

public static String readInternalFileContent(Context content, String fileName) {
    String file = new String(), tmp;
    try {//from   www.  j  a va2 s . c o m
        // Read the file
        BufferedReader bf = new BufferedReader(new InputStreamReader(content.openFileInput(fileName)));
        while ((tmp = bf.readLine()) != null) {
            file += tmp;
        }
        bf.close();
    } catch (IOException e) {
        Log.e("JSO reading", "Error reading the file " + fileName + "\n" + e.getMessage());
    }
    return file;
}

From source file:Main.java

public static String getMD5(String mykey) {
    try {// ww w  .  j a  v a2  s. co  m
        MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
        digest.update(mykey.getBytes(Charset.forName("UTF-8")));
        return bytesToHex(digest.digest()).toLowerCase();
    } catch (NoSuchAlgorithmException e) {
        Log.e(TAG, "MD5 hash exception: " + e.toString());
        return null;
    }
}

From source file:Main.java

/**
 * Convert a bitmap to a byte array//from  w w  w .j a v a 2s .c om
 * @param path the path to the picture on the phone
 * @return the image in a byte array
 */
public static byte[] picToByte(Bitmap bitmap) {
    if (bitmap == null) {
        return null;
    }
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 10, baos);
    byte[] ba = baos.toByteArray();
    try {
        baos.close();
    } catch (IOException e) {
        Log.e("Error", "Error closing output stream" + e.getMessage());
        return null;
    }
    return ba;

}

From source file:Main.java

public static String getCrop(Activity activity, String name) {
    Bitmap bmp = getCrop(activity);//  w  ww  .  j  a  va 2 s.c om
    File file = new File(activity.getFilesDir(), name);
    FileOutputStream fileOutput = null;
    try {
        fileOutput = new FileOutputStream(file);
    } catch (FileNotFoundException e) {
        Log.e("golfpad", e.getMessage());
    }
    bmp.compress(CompressFormat.JPEG, 50, fileOutput);
    return file.getAbsolutePath();
}

From source file:Main.java

public static void showLog(String info) {
    Log.e("TAG", info);
}