Skip to content Skip to sidebar Skip to footer

Android How To View Long String In Logcat

I have a HashMap that is fairly long (not an issue) and I'm trying to make sure things look correct before I use the data inside it. T

Solution 1:

Logcat can only show about 4000 characters. So you need to call a recursive function to see the entire hashmap. Try this function:

public static void longLog(String str) {
    if (str.length() > 4000) {
        Log.d("", str.substring(0, 4000));
        longLog(str.substring(4000));
    } else
        Log.d("", str);
}

Post a Comment for "Android How To View Long String In Logcat"