Observe very long String content in Eclipse

不羁的心 提交于 2019-12-08 16:07:25

问题


Since LogCat truncates long strings, I work around this using FileOutputStream to inspect the contents of very long strings.

It works but it forces me to 'adb pull' that file, which is not very convenient, compare to watching it on LogCat.

Is there any other way in Eclipse to watch very long strings?


回答1:


For the record, the answer was found here.




回答2:


when you stop in debug on the variable do the following and past it to a text file




回答3:


I think it will be easier to use the eclipse debugging view.

Set a break point at the line where you call Log.* and run your app in debug mode. When execution reaches the break point the app will ... yes, it will halt.

In the Variables window you may now browse your data and display whatever you need. Copy and paste it at a safe place as well and don't forget to smile :)




回答4:


What I do, is in "Variables->Change value".

That will show you a Windows with the full text. Then just Copy&paste to notepad.




回答5:


try this:

public void logLargeString(String str) {

    if(str.length() > 3000) {
        Log.i(TAG, str.substring(0, 3000));
        logLargeString(str.substring(3000));
    } else
        Log.i(TAG, str);
    }
}


来源:https://stackoverflow.com/questions/5381654/observe-very-long-string-content-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!