Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. task = new LoadJsonTask(new MyJsonResponseListner() {
  2. @Override
  3. public void onJsonResponseChange(String string) {
  4. Log.d("debtors", string);
  5. try {
  6. JSONObject job = new JSONObject(string);
  7. String responseType = job.getString("response");
  8. StringBuilder stringBuilder = new StringBuilder();
  9. if (responseType.equals("success")) {
  10. JSONArray debtorsJsonArray = new JSONArray(job.getString("debtors"));
  11. for (int i = 0; i < debtorsJsonArray.length(); i++) {
  12. JSONObject jsonArrayObj = debtorsJsonArray.getJSONObject(i);
  13. stringBuilder.append(jsonArrayObj.getString("Id")+ " ");
  14. stringBuilder.append(jsonArrayObj.getString("Name")+ " ");
  15. stringBuilder.append(jsonArrayObj.getString("Phone")+ " ");
  16. stringBuilder.append(jsonArrayObj.getString("Photo")+ " ");
  17. }
  18. Log.d("debtors", stringBuilder.toString());
  19. textView.setText(stringBuilder.toString());
  20. }
  21. } catch (Exception e) {
  22. }
  23. }
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement