How Android views long strings in logcat… here is a solution to the problem.
How Android views long strings in logcat
I have a HashMap<
String, LinkedHashMap<String, String>
which is quite long (not a problem) and I try to make sure things look right before using the data in it. To do this, I just tried to do Log.v("productsFromDB",products.toString())
but at LogCat
, it shows about 1/3. Is there a way to output the whole image?
Solution
Logcat can only display about 4000 characters. So you need to call a recursive function to view the entire hashmap. Try this feature:
public static void longLog(String str) {
if (str.length() > 4000) {
Log.d("", str.substring(0, 4000));
longLog(str.substring(4000));
} else
Log.d("", str);
}