Observe very long String content in Eclipse
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 开发者_StackOverflow社区not very convenient, compare to watching it on LogCat.
Is there any other way in Eclipse to watch very long strings?
For the record, the answer was found here.
when you stop in debug on the variable do the following and past it to a text file
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 :)
What I do, is in "Variables->Change value".
That will show you a Windows with the full text. Then just Copy&paste to notepad.
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);
}
}
精彩评论