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

private static File getAlbumStorageDir(String albumName) {
    // Get the directory for the user's public pictures directory. 
    File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
            albumName);//from   w ww .ja v  a2  s  . c  om
    if (file.exists()) {
        return file;
    }
    if (!file.mkdirs()) {
        Log.e(TAG, "Directory not created");
    }
    return file;
}

From source file:Main.java

/**
 * //from   w  w  w. ja  v a  2 s. co  m
 * @param context
 * @return
 */
public static Typeface getFAFont(Context context) {
    Typeface tf = null;
    try {
        tf = Typeface.createFromAsset(context.getAssets(), font_awesome);
    } catch (Exception e) {
        Log.e(TAG, "Failed to load FontAwesome Font");
        Toast.makeText(context, "Failed to load FontAwesome Font", Toast.LENGTH_SHORT).show();
    }
    return tf;
}

From source file:Main.java

public static String getVersionInfo(Context context) {
    PackageManager packageManager = context.getPackageManager();
    try {//ww  w .  j  a  v  a  2 s  .  co  m
        PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
        return packageInfo.versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
        Log.e("majunjun", "can't reach........");
        return "";
    }
}

From source file:Main.java

public static boolean isOnline(Context ctx) {
    try {//from  w  ww.j a v  a2 s  .  c  o m
        ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
        return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnectedOrConnecting();

    } catch (Exception ex) {
        if (enableLogs)
            Log.e(TAG, ex.toString());
    }
    return false;
}

From source file:Main.java

public static boolean noSpecialCharacters(EditText editText) {
    if (nonEmpty(editText)) {
        String content = removeBlankSpace(editText.getText().toString());
        return content.matches("[a-zA-Z0-9.? ]*");
    } else {//from w  ww  .  j  a va  2 s .c  o  m
        Log.e("SERI_PAR->Error", "edit text object is null");
        return NO;
    }
}

From source file:Main.java

public static Point getScreenResolution(Context context) {
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    Point wh = new Point(display.getWidth(), display.getHeight());
    if (wh.x == 0 || wh.y == 0) {
        Log.e("AndroidUtils", "Screen resolution " + wh + " for " + context);
    }/*from   w ww  . ja va2s  .  co  m*/
    return wh;
}

From source file:Main.java

private static byte[] getKeyBytes(String mykey) {
    try {/*from ww  w .j  a  v a  2  s.  c  o  m*/
        MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
        digest.update(mykey.getBytes(Charset.forName("UTF-8")));
        return digest.digest();
    } catch (NoSuchAlgorithmException e) {
        Log.e(TAG, "Password creation exception: " + e.toString());
        return errorbyte;
    }
}

From source file:Main.java

public static boolean matchMinLength(EditText editText, int length) {
    if (nonEmpty(editText)) {
        String content = removeBlankSpace(editText.getText().toString());
        return content.length() >= length ? YES : NO;
    } else {//from w ww  . j  ava  2  s.c o m
        Log.e("SERI_PAR->Error", "edit text object is null");
        return NO;
    }
}

From source file:Main.java

private static int compileShader(int target, String source, int[] output) {
    output[0] = GLES20.glCreateShader(target);

    //   const GLchar *str = src.c_str();
    GLES20.glShaderSource(output[0], source);
    GLES20.glCompileShader(output[0]);/*from   w w w  .  j  a  v a2 s.  com*/
    checkGLError("Compile shader");
    int[] status = new int[1];
    GLES20.glGetShaderiv(output[0], GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e(TAG, "Failed to compile shader: " + GLES20.glGetShaderInfoLog(output[0]));
        GLES20.glDeleteShader(output[0]);
    }
    return status[0];
}

From source file:Main.java

public static boolean checkConn(Context ctx) {
    ConnectivityManager conMgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);

    if (conMgr.getNetworkInfo(conMgr.TYPE_MOBILE).isConnectedOrConnecting()
            || conMgr.getNetworkInfo(conMgr.TYPE_WIFI).isConnectedOrConnecting()) {
        Log.v(TAG, "Able to connect to the network");
        return true;
    } else {//from   ww  w.  jav a2  s . com
        Log.e(TAG, "Unable to connect to network");
    }
    return false;
}