Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPedro Duarte
300 PointsJsonArray return?
private TableSoccer getCurrentDetails(String jsonData) throws JSONException {
JSONObject table = new JSONObject(jsonData);
String leagueCaption = table.getString("leagueCaption");
Log.i(TAG, "From Json: " + leagueCaption);
JSONArray standingArray = table.getJSONArray("standing");
//this will be used to hold all the extracted objects inside standingArray.
ArrayList<TableSoccer> tableSoccerElements = new ArrayList<>();
for (int i = 0; i < standingArray.length(); i++) {
JSONObject standingObject = standingArray.getJSONObject(i);
TableSoccer tableSoccer = new TableSoccer();
tableSoccer.setmPosition(standingObject.getInt("position"));
tableSoccer.setmPoints(standingObject.getInt("points"));
tableSoccer.setmWins(standingObject.getInt("wins"));
tableSoccer.setmLosses(standingObject.getInt("losses"));
tableSoccerElements.add(tableSoccer);
}
return ;
}
i stuck in the return i wish to know how to show this dates like position, points, wins, losses, but android say getCurrentDetails but didin't work... how this need to return.
Thank you Pedro Duarte