String is being truncated when its too long

后端 未结 5 1635
执笔经年
执笔经年 2020-12-31 18:19

I am trying to get a JSON response from our server and the response string seems is always being truncated when the string length reaches to around 5525 characters.

5条回答
  •  盖世英雄少女心
    2020-12-31 19:07

    Although its quite late but may help someone else i used this code to display complete LONG string. Found somewhere on same site

    int maxLogSize = 1000;
    for(int i = 0; i <= veryLongString.length() / maxLogSize; i++) {
        int start = i * maxLogSize;<
        int end = (i+1) * maxLogSize;
        end = end > veryLongString.length() ? veryLongString.length() : end;
        Log.v(TAG, veryLongString.substring(start, end));
    }
    

    Please Vote up if found helpful :)

提交回复
热议问题