I'm new to android development but i have some Java background. In Java when using loop i used System.out.println();
but in Android after loop finishes, I only get the last result. I'm using JSON data which contains 10 lines.
Here's my code:
json = new JSONObject(result);
JSONArray articles = json.getJSONArray("entries"); // get articles array
for(int i = 0; i <articles.length(); i++) {
etResponse.setText(articles.getJSONObject(i).toString());
}
etResponse
is my EditText
and it only shows last line.
I have also tried:
builder.append(String.valueOf(articles.getJSONObject(i).toString()));
But it gave no data. So my question is how to get all lines data printed, not just the last one?