问题
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?
回答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);
}
来源:https://stackoverflow.com/questions/24636089/android-how-to-view-long-string-in-logcat