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

/**
 * Method for showing Log messages.//from w ww  . j a va 2 s  . co m
 *
 * @param message
 */
public static void showLog(String tag, Object message) {

    if (ENABLE_LOG) {
        if (tag == null || tag.isEmpty()) {
            Log.d(TAG_INSTAGRAM, String.valueOf(message));
        } else {
            Log.d(tag, String.valueOf(message));
        }
    }

}

From source file:Main.java

public static void setChosenAccountName(final Context context, final String accountName) {
    Log.d(TAG, "Chose account " + accountName);
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putString(PREF_CHOSEN_ACCOUNT, accountName).commit();
}

From source file:Main.java

public static void d(String tag, String msg) {
    if (isDebug) {
        if (tag == null || "".equalsIgnoreCase(tag.trim())) {
            tag = mTag;//from w w  w  .j  a  v  a  2  s . c  o  m
        }
        Log.d(tag, msg);
    }
}

From source file:Main.java

public static void clearAppData(String packageName) {
    String s = do_exec_with_root(CMD_CLEAR_APP_DATA + packageName);
    Log.d("TAG", "clear data result is " + s + "..........");
}

From source file:Main.java

public static void forceStopApp(String packageName) {
    String s = do_exec_with_root(CMD_FORCE_STOP_APP + packageName);
    Log.d("TAG", "force stop result is " + s + "..........");
}

From source file:Main.java

public static boolean isServiceRunning(Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        Log.d("InformatonUtils", "Service Name = " + service.service.getClassName());
        if ("com.safecell.TrackingService".equals(service.service.getClassName())) {
            return true;
        }//w w w .j  av  a2 s.  c o  m
    }
    return false;
}

From source file:Main.java

public static void closeSilently(Object... xs) {
    // Note: on Android API levels prior to 19 Socket does not implement Closeable
    for (Object x : xs) {
        if (x != null) {
            try {
                Log.d(TAG, "closing: " + x);
                if (x instanceof Closeable) {
                    ((Closeable) x).close();
                } else if (x instanceof Socket) {
                    ((Socket) x).close();
                } else if (x instanceof DatagramSocket) {
                    ((DatagramSocket) x).close();
                } else {
                    Log.d(TAG, "cannot close: " + x);
                    throw new RuntimeException("cannot close " + x);
                }// ww w  . j a va  2s .  c  om
            } catch (Throwable e) {
                Log.e(TAG, e.getMessage());
            }
        }
    }
}

From source file:Main.java

public static void logging(String logString) {
    if (LOG) {//from w w w  .j ava2 s.  c  o  m
        int maxLogSize = 999;
        for (int i = 0; i <= logString.length() / maxLogSize; i++) {
            int start = i * maxLogSize;
            int end = (i + 1) * maxLogSize;
            end = end > logString.length() ? logString.length() : end;
            Log.d("KORA.COM", logString.substring(start, end));
        }
    }
}

From source file:Main.java

public static void d(String tag, String msg) {
    if (DEBUG) {
        Log.d(tag, msg);
    }
}

From source file:Main.java

public static void dumpCurrentSharedPrerence(SharedPreferences pref) {
    Map<String, ?> map = pref.getAll();
    Iterator<String> ite = map.keySet().iterator();
    while (ite.hasNext()) {
        String key = ite.next();/*  w w  w.  j av a2  s.co m*/
        Log.d(TAG, "dump " + key + " : " + String.valueOf(map.get(key)));
    }
}