是否有限制的logcat如何串多大打印?多大、logcat

2023-09-05 23:19:28 作者:幸福一半阳光

我试图找出通过打印结果我的logcat code是否是拉动整个RSS源,但它似乎只显示这么多的上述字符串。所以我想弄清楚,如果那里有一个问题,在code还是logcat中有大串的限制。

I'm trying to figure out whether my code is pulling the whole of an RSS feed by printing the result to logcat, but it appears to only display so much of the aforementioned string. So I'm trying to figure out if theres a problem with the code or whether logcat has a limit on large strings.

推荐答案

我相信它盖在1000个字符的字符串。你可以分割字符串,然后登录这一块一块象下面这样:

I believe it caps the string on 1000 characters. You could split the string and then log it piece by piece like below :

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

希望这会有所帮助。

hope this helps.