Why in this loop "hello world" is shown just 2 times, not 20 times?
for(int j=0; j<20; j++){
Log.d("myTag","hello world");
}
Please explain what's going on.
Why in this loop "hello world" is shown just 2 times, not 20 times?
for(int j=0; j<20; j++){
Log.d("myTag","hello world");
}
Please explain what's going on.
Maybe this is because of identical tag names or messages. Seems that it doesn't allow more than two same logs. You can use
for(int j=0;j<20;j++){
Log.d("myTag" + j,"hello world");
}
or
for(int j=0;j<20;j++){
Log.d("myTag","hello world" + j);
}
In logcat you can see these lines,
Also you have the same issue with this loop:
for (j in 0..19) {
Log.d("myTag", "${j/20}")
}
But this loop runs as desired:
for (j in 0..19) {
Log.d("myTag", "$j")
}
Apparently Android Studio doesn't show identical logs. Also see these two links: android logcat logs chatty module line identical message and android logcat logs chatty module line expire message