Android之Json数据过长打印不全问题

在logcat中打后台打印json数据时,json数据太过于长就会有打印不全的问题,这里记录一个办法就是分段打印:

// 采用分段打印 四千字符分一段
if (response.length() > 4000) {
    for (int i = 0; i < response.length(); i += 4000) {
        if (i + 4000 < response.length()) {
            Log.i("第" + i + "数据", response.substring(i, i + 4000));
        } else {
            Log.i("第" + i + "数据", response.substring(i, response.length()));
        }
    }
} else {
    Log.i("全部数据", "************************  response = " + response);

-END

收藏 (0)
评论列表
正在载入评论列表...
我是有底线的