Example usage for android.util Log d

List of usage examples for android.util Log d

Introduction

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

Prototype

public static int d(String tag, String msg) 

Source Link

Document

Send a #DEBUG log message.

Usage

From source file:Main.java

public static boolean validateEmail(EditText editText) {
    if (nonEmpty(editText)) {
        String emailAsString = removeBlankSpace(editText.getText().toString());
        return emailAsString.matches(EMAIL_PATTERN_1) || emailAsString.matches(EMAIL_PATTERN_2);

    } else {//from   w ww.  j  ava  2  s  .  c o  m
        Log.d("SERI_PAR->Error", "edit text object is null");
        return NO;
    }
}

From source file:Main.java

/**
 * A simple wrapper around LOGD/*from w  w  w. ja  v a  2  s.  c o  m*/
 */
public static final void LOGD(String TAG, String message) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, message);
    }
}

From source file:Main.java

public static String trimQuotes(String s) {
    if (null != s && s.length() > 1) {
        if (s.startsWith("\"\\\"") && s.endsWith("\\\"\"")) {
            Log.d("MagnetUtils", "String " + s + " starting with \\\"");
            s = s.substring(3, s.length() - 3);
        } else if (s.startsWith("\"") && s.endsWith("\"")) {
            s = s.substring(1, s.length() - 1);
        }//from w  ww  .j  a  va2 s . c om
    }

    return s;
}

From source file:at.bitfire.davdroid.URIUtils.java

public static String ensureTrailingSlash(String href) {
    if (!href.endsWith("/")) {
        Log.d(TAG, "Implicitly appending trailing slash to collection " + href);
        return href + "/";
    } else//w w w.  j  a v a 2  s  . c om
        return href;
}

From source file:Main.java

/**
 * Reads in model 83 points and returns a double array float containing the
 * coordinates x & y.//from  w  ww.j  a v a  2 s  .c o  m
 */
public static float[][] readBinModel83Pt2DFloat(String dir, String fileName) {
    float[][] array2D = new float[83][2];
    float x;
    int i = 0;
    File sdLien = Environment.getExternalStorageDirectory();
    File inFile = new File(sdLien + File.separator + dir + File.separator + fileName);
    Log.d(TAG, "path of file : " + inFile);
    if (!inFile.exists()) {
        throw new RuntimeException("File doesn't exist");
    }
    DataInputStream in = null;
    try {
        in = new DataInputStream(new FileInputStream(inFile));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    try {
        while (true) {
            x = in.readFloat();
            array2D[i][0] = x;
            x = in.readFloat();
            array2D[i][1] = x;
            i++;
        }
    } catch (EOFException e) {
        try {
            Log.d(TAG, "close");
            in.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (in != null) {
            try { //free ressources
                Log.d(TAG, "close");
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return array2D;
}

From source file:Main.java

/**
 * Return camera instance//  ww  w  . j a  va  2 s .  c  o m
 */
public static Camera getCameraInstance(int displayOrientation) {
    Camera cam = null;
    try {
        cam = Camera.open();

        // More efficient way to find available cameras. Nexus 7 needs this.
        if (cam == null) {
            int availableCameras = Camera.getNumberOfCameras();
            for (int i = 0; i < availableCameras; i++) {
                cam = Camera.open(i);
                if (cam != null)
                    break;
            }
        }

        cam.setDisplayOrientation(displayOrientation);
        Log.d(TAG, "Getting Camera: " + cam.toString());
    } catch (Exception e) {
        Log.e(TAG, "Camera is not available (in use or does not exist)");
        Log.e(TAG, e.toString());
    }
    return cam;
}

From source file:Main.java

/**
 * Takes in the file stream to the offline file storage that is going to be written to and
 * the latest trip data that is going to be written to the offline storage file.
 * <p/>/*w ww. ja v  a2 s . c o m*/
 * The new trip data will then be appended to the rest of the trip data.
 *
 * @param writer The output stream of the offline file for storage. Get this from {@link android.content.Context#openFileOutput}
 * @param line   The new trip data as a String
 */
public synchronized static void writeToOfflineStorage(FileOutputStream writer, String line) {
    try {
        line += "\n";
        writer.write(line.getBytes());
    } catch (IOException e) {
        //TODO: Handle IO exception
        Log.d("ERROR", "IO Exception in OfflineUtilities#writeToOfflineStorage: " + e.getMessage());
    }
}

From source file:Main.java

public static boolean ensureWifi(Context context) {
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo == null || !netInfo.isConnectedOrConnecting())
        return false;
    // always OK if we're on wifi
    if (netInfo.getType() == ConnectivityManager.TYPE_WIFI)
        return true;
    // check for wifi only pref
    if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("wifiPref", true)) {
        Log.d("Podax", "Not downloading because Wifi is required and not connected");
        return false;
    }//from  w w w.  j ava2 s .  c o  m
    // check for 3g data turned off
    if (!netInfo.isConnected()) {
        Log.d("Podax", "Not downloading because background data is turned off");
        return false;
    }

    return true;
}

From source file:Main.java

private static Method getColumnGetMethod(Class<?> entityType, Field field, String suffix) {
    String fieldName = field.getName();
    Method getMethod = null;//from  w w  w. j a v a  2  s. c o  m
    if (field.getType() == boolean.class) {
        getMethod = getBooleanColumnGetMethod(entityType, fieldName, suffix);
    }
    if (getMethod == null) {
        String methodName = "get" + fieldName.substring(0, 1).toUpperCase(Locale.getDefault())
                + fieldName.substring(1) + suffix;
        try {
            getMethod = entityType.getDeclaredMethod(methodName);
        } catch (NoSuchMethodException e) {
            Log.d("T", methodName + " not exist");
        }
    }
    return getMethod;
}

From source file:Main.java

private static void extractZipToPath(ArrayList<ZipEntry> entries, ZipFile nar, String targetPath, boolean strip)
        throws IOException {
    Log.d(TAG, " =>extracting to" + targetPath);
    checkAndMakeDir(targetPath);/*from   w w  w. j a  va2s . co  m*/
    for (ZipEntry e : entries) {
        if (e.isDirectory()) {
            //checkAndMakeDir(targetPath + e.getName());
        } else {
            extractFileToPath(nar, targetPath, e, false, strip);
        }
    }
}