I am using a log statement for a click listener to show the Strings in a array list. And as per the official documentation, the "tag" parameter in Log.i(tag, message) is used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.Below is the code to log the strings of array list.
for (int i = 0; i < Response.size(); i++){
Log.i("Resulted String", Response.get(i));
}
In the logcat, the strings in arraylist have been displayed. but, for the first run tag statement is displayed before all the strings. and second run the tag is displaying 2/3 times and so on.below is the output which i got for the first run of the code.
Resulted String: StatusOK
Amount2500.00score983
CAR25.00score773
LAR2200.00score780
Codeline.125000024._81922_767,_1127score993
PayeeNameGscore23
DateMay5,2018score925
CheckNumber1127score1000
And the tag is displaying as follows for the next runs.
Resulted String: StatusOK
Amount2500.00score983
CAR25.00score773
LAR2200.00score780
Codeline.125000024._81922_767,_1127score993
PayeeNameGscore23
Resulted String: DateMay5,2018score925
CheckNumber1127score1000
Resulted String: StatusOK
Amount2500.00score983
CAR25.00score773
Resulted String: LAR2200.00score780
Codeline.125000024._81922_767,_1127score993
PayeeNameGscore23
DateMay5,2018score925
CheckNumber1127score1000
My question is why this tag statement not getting displayed along with each string and why displaying only with couple of strings and on which basis.
Please someone give the clarification.
Thanks
You can use
StringBuilder
as follows to achieve your intended output: