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.
Is there a limit to how much of a string Logcat will print?
Asked Answered
Year. there is a limit. write string to file. –
Beitz
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.
Superb, exactly what I was looking for. My RSS feed is being pulled intact, thanks for saving me hours of trying to fix something that wasn't broken! ^_^ –
Ectomy
I am glad it helps. You could accept it as answer if it works for you ;) –
Ernaldus
It saves my time. I am having the same issue... i am fetching facebook friends list(name & id) of all friends of login user & when i print these in logcat then only few name-id are visible. then i try it & it will solve my problem. –
Armistice
© 2022 - 2024 — McMap. All rights reserved.