3

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 Answer 1

22

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);
}
3
  • how to remove " [ 12-09 12:34:09.886 27901:27901 V/ " all time?i want to see chunk of json but there are v and date .i want to get full chunk with out v and date.any way?
    – Suman
    Dec 9, 2016 at 7:25
  • @Suman I dont think it can be done though I would like to be proved wrong Dec 9, 2016 at 10:40
  • ,thanks for your reply.I want see whole log without time or type or any thing else.mean when i copy from log then some some time and type are added into string,
    – Suman
    Dec 9, 2016 at 19:13

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.