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

static public boolean setPin(Class btClass, BluetoothDevice btDevice, String str) throws Exception {
    try {//from w w  w  .j  a  v  a 2 s. c  o m
        Method method = btClass.getDeclaredMethod("setPin", new Class[] { byte[].class });
        Boolean value = (Boolean) method.invoke(btDevice, new Object[] { str.getBytes() });
        Log.e(TAG, "" + value);
    } catch (Exception e) {
        // TODO: handle exception
        Log.e(TAG, "setPin error++");
        return false;
    }
    return true;
}

From source file:Main.java

public static int getVerCode(Context context, String packageName) {
    int verCode = -1;
    try {/*  w ww .  j  a  va 2  s  . c o m*/
        verCode = context.getPackageManager().getPackageInfo(packageName, 0).versionCode;
    } catch (NameNotFoundException e) {
        Log.e(TAG, e.getMessage());
    }
    return verCode;
}

From source file:Main.java

public static void e(String message) {

    if (!isLog) {
        return;//from   ww w .  j a v  a  2 s .  c o  m
    }
    Log.e("CommonTool", message);

}

From source file:Main.java

private static boolean isBefore(Calendar date, String time) {
    try {/*from w  ww. java 2 s . com*/
        String[] arr = time.split(":");
        int hours = Integer.parseInt(arr[0]);
        int mins = Integer.parseInt(arr[1]);
        return (date.get(Calendar.HOUR_OF_DAY) < hours)
                || (date.get(Calendar.HOUR_OF_DAY) == hours && date.get(Calendar.MINUTE) < mins);
    } catch (Exception e) {
        Log.e("Utils.java isBefore",
                "The supplied times are not properly formatted. Verify that your schedule times follow the hh:mm pattern");
        return true;
    }
}

From source file:Main.java

public static String getVerName(Context context, String packageName) {
    String verName = "";
    try {//from ww w  . j av a2 s.  c  om
        verName = context.getPackageManager().getPackageInfo(packageName, 0).versionName;
    } catch (NameNotFoundException e) {
        Log.e(TAG, e.getMessage());
    }
    return verName;
}

From source file:Main.java

/**
 * Closes the specified stream./*from   w  ww. j av  a 2  s . c  o m*/
 *
 * @param stream The stream to close.
 */
public static void closeStream(final Closeable stream) {
    if (stream != null) {
        try {
            stream.close();
        } catch (final IOException e) {
            Log.e(TAG, "Could not close stream " + e);
        }
    }
}

From source file:Main.java

public static void failExit(final Activity activity, final String task, final String msg, final Object o) {
    if (o instanceof Exception) {
        Exception e = (Exception) o;
        String emsg = e.getClass().getName() + ": " + e.getMessage();
        String m = task + " " + msg + ": " + emsg;

        Log.e(task, m);
        alert(activity, m, "ok", true);
    } else {/*from w  w  w.  j av a2  s . com*/
        alert(activity, "Hop Fail Exit: " + o.toString(), "ok", true);
    }
}

From source file:Main.java

public static void openBrowser(Context context, String url) {
    if (!TextUtils.isEmpty(url)) {
        if (!url.startsWith("http://") && !url.startsWith("https://")) {
            url = "http://" + url;
        }//from   w  ww. j a v a 2s .c  o  m
        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    } else {
        Log.e("Helpers#openBrowser", "Something isn't right about the URL passed");
    }
}

From source file:Main.java

public static void toMarket(Context context) {
    try {// ww w  . ja v  a  2 s.  com
        context.startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
    } catch (android.content.ActivityNotFoundException e) {
        Log.e(TAG, "market can't open " + e);
    }
}

From source file:Main.java

static public boolean setPin(Class<? extends BluetoothDevice> btClass, BluetoothDevice btDevice, String str)
        throws Exception {
    try {//ww  w  . j a  v a  2s. c  o m
        Method removeBondMethod = btClass.getDeclaredMethod("setPin", new Class[] { byte[].class });
        Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice, new Object[] { str.getBytes() });
        Log.e("returnValue", "" + returnValue);
    } catch (SecurityException e) {
        // throw new RuntimeException(e.getMessage());  
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        // throw new RuntimeException(e.getMessage());  
        e.printStackTrace();
    } catch (Exception e) {
        // TODO Auto-generated catch block  
        e.printStackTrace();
    }
    return true;

}