是否有限制的logcat如何串多大打印? [英] Is there a limit to how much of a string Logcat will print?

查看:81
本文介绍了是否有限制的logcat如何串多大打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出通过打印结果我的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.

这篇关于是否有限制的logcat如何串多大打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆