Android how to view long string in logcat
android, hashmap, java, linkedhashmap, logcat
Solution
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);
}
Problem
I have a `HashMap<String, LinkedHashMap<String,String>` that is fairly long (not an issue) and I'm trying to make sure things look correct before I use the data inside it. To do this I'm trying to just attempting to do this `Log.v("productsFromDB",products.toString())` but in the `LogCat` It shows about 1/3 of it. Is there a way to output the entire map?