Created
April 19, 2009 20:22
-
-
Save mattapayne/98202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. private List parseComplaints(String results) | |
2. { | |
3. List complaints = new ArrayList(); | |
4. try | |
5. { | |
6. JSONArray objects = new JSONArray(results); | |
7. for(int i=0; i<objects.length(); i++) | |
8. { | |
9. JSONObject o = (JSONObject)objects.get(i); | |
10. Complaint c = new Complaint(); | |
11. c.setId(o.getString(Constants.ID_ATTR)); | |
12. c.setCategory(o.getString(Constants.CATEGORY_ATTR)); | |
13. c.setComplaint(o.getString(Constants.COMPLAINT_ATTR)); | |
14. c.setDateSubmitted(o.getString(Constants.DATE_ATTR)); | |
15. c.setLatitude(o.getString(Constants.LATITUDE_ATTR)); | |
16. c.setLongitude(o.getString(Constants.LONGITUDE_ATTR)); | |
17. c.setSubmittedBy(o.getString(Constants.SUBMITTED_BY_ATTR)); | |
18. c.setVotesAgainst(o.getString(Constants.VOTE_AGAINST_ATTR)); | |
19. c.setVotesFor(o.getString(Constants.VOTE_FOR_ATTR)); | |
20. complaints.add(c); | |
21. } | |
22. } | |
23. catch(JSONException je) | |
24. { | |
25. Log.e("Error", "Error parsing complaints: " + je.getMessage()); | |
26. } | |
27. return complaints; | |
28. } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment