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

public static String getCommandList(ArrayList<String> commands) {
    if (commands == null || commands.size() == 0) {
        return "";
    }//from   w  w w . j a v  a  2 s .  c  o  m

    StringBuilder sb = new StringBuilder();
    for (String commandPattern : commands) {
        String[] cmdSplit = commandPattern.split("~");
        if (cmdSplit.length != 3) {
            Log.e("DebugGhost", "Cannot read command pattern '" + commandPattern + "', skipping ...");
            continue;
        }

        if (cmdSplit[2].contains("[") == true && cmdSplit[2].contains("]") == true) {
            continue;
        }

        sb.append(
                "<button type=\"button\" style=\"margin-bottom: 5px;\" class=\"btn btn-default\" onclick=\"postCommand('/commands/");
        sb.append(cmdSplit[1]);
        sb.append("','");
        sb.append(cmdSplit[2]);
        sb.append("');\">");
        sb.append(cmdSplit[0]);
        sb.append("</button>");
    }

    return sb.toString();
}

From source file:Main.java

public static void setLocale(Context context, String language) {
    persist(context, language);//from   w w w . j  av a  2 s.  co  m
    updateResources(context, language);
    Log.e("setLocale", " = " + language);
}

From source file:Main.java

/**
 * read inputstream and return the byte array
 * @param inputStream/*from   www. j a v  a2s  .  co m*/
 * @return
 * @throws IOException
 */
public static byte[] readBytesFromInputStream(InputStream inputStream) throws IOException {
    if (inputStream == null) {
        Log.e(TAG, "invalid inputStream");
        return null;
    }

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    int read = inputStream.read();
    while (read != -1) {
        byteArrayOutputStream.write(read);
        read = inputStream.read();
    }

    return byteArrayOutputStream.toByteArray();
}

From source file:Main.java

private static void deleteDirectorySync(File dir) {
    try {/*ww  w  . j  a  va 2  s .  c  om*/
        File[] files = dir.listFiles();
        if (files != null) {
            for (File file : files) {
                String fileName = file.getName();
                if (!file.delete()) {
                    Log.e(TAG, "Failed to remove " + file.getAbsolutePath());
                }
            }
        }
        if (!dir.delete()) {
            Log.w(TAG, "Failed to remove " + dir.getAbsolutePath());
        }
        return;
    } catch (Exception e) {
        Log.e(TAG, "Failed to remove old libs, ", e);
    }
}

From source file:Main.java

static String getCallingPackageName(Activity activity) {
    // getCallingPackage() was unstable until android-18, use this
    String packageName = activity.getCallingActivity().getPackageName();
    if (TextUtils.isEmpty(packageName)) {
        packageName = activity.getIntent().getPackage();
    }// www  .  ja v a2  s.c o m
    if (TextUtils.isEmpty(packageName)) {
        Log.e(activity.getPackageName(),
                "Received blank Panic.ACTION_DISCONNECT Intent, it must be sent using startActivityForResult()!");
    }
    return packageName;
}

From source file:Main.java

/**
 * Just like {@link Intent#getStringExtra(String)} but doesn't throw exceptions.
 *///from   w w w .  j a v a  2s  . c o  m
public static String safeGetStringExtra(Intent intent, String name) {
    try {
        return intent.getStringExtra(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getStringExtra failed on intent: " + intent);
        return null;
    }
}

From source file:Main.java

public static String getCommandInputList(ArrayList<String> commands) {
    if (commands == null || commands.size() == 0) {
        return "";
    }/*from w w w . j  a  va2  s .  c  om*/

    StringBuilder sb = new StringBuilder();
    for (String commandPattern : commands) {
        String[] cmdSplit = commandPattern.split("~");
        if (cmdSplit.length != 3) {
            Log.e("DebugGhost", "Cannot read command pattern '" + commandPattern + "', skipping ...");
            continue;
        }
        if (cmdSplit[2].contains("[") == false && cmdSplit[2].contains("]") == false) {
            continue;
        }

        String realValue = cmdSplit[2].replace("[", "").replace("]", "");

        sb.append("<div class=\"input-group\" style=\"margin-bottom: 5px;\">");
        sb.append("<span class=\"input-group-btn\">");
        sb.append("<button class=\"btn btn-default\" type=\"button\" onclick=\"postCommandValue('/commands/");
        sb.append(cmdSplit[1]);
        sb.append("','");
        sb.append(cmdSplit[1]);
        sb.append("');\" >");
        sb.append(cmdSplit[0]);
        sb.append("</button></span>");
        sb.append("<input id=\"" + cmdSplit[1]
                + "\" type=\"text\" class=\"form-control\" placeholder=\"set your value here\" value=\""
                + realValue + "\">");
        sb.append("</div>");
    }

    return sb.toString();
}

From source file:Main.java

/**
 * This method converts device specific pixels to density independent
 * pixels. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE.
 *
 * @param px A value in px (pixels) unit. Which we need to convert into db
 * @return A float value to represent dp equivalent to px value
 *//*from  w ww  .  j  av  a 2s  .c  o m*/
public static float convertPixelsToDp(float px) {

    if (mMetrics == null) {

        Log.e("MPChartLib-Utils", "Utils NOT INITIALIZED. You need to call Utils.init(...) at least once before"
                + " calling Utils.convertPixelsToDp(...). Otherwise conversion does not" + " take place.");
        return px;
        // throw new IllegalStateException(
        // "Utils NOT INITIALIZED. You need to call Utils.init(...) at least once before
        // calling Utils.convertPixelsToDp(...).");
    }

    DisplayMetrics metrics = mMetrics;
    float dp = px / (metrics.densityDpi / 160f);
    return dp;
}

From source file:Main.java

public static Process deleteBuildProperty(Context c, String propName) {
    Process p = null;/*w  ww.  j ava  2  s. co  m*/
    try {
        remountSystem(c);

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

From source file:Main.java

public static String getFacebookId(Context context) {
    if (facebookId != null)
        return facebookId;
    else {/*from   w w  w . ja  va2 s . c  om*/
        SharedPreferences prefs = context.getSharedPreferences("profilo", Context.MODE_PRIVATE);
        String id = prefs.getString("reg_id", "");
        if (id.isEmpty()) {
            Log.e("HELPER_FACEBOOK", "id facebook not found.");
            return null;
        } else {
            facebookId = id;
            return facebookId;
        }
    }
}