Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. protected Void doInBackground(Void... params) {
  2. // Create an array
  3. arraylist = new ArrayList<HashMap<String, String>>();
  4. // Retrieve JSON Objects from the given URL address
  5. jsonobject = JSONfunctions
  6. .getJSONfromURL("http://.../android_ofertaslist_todas.php");
  7.  
  8. try {
  9. // Locate the array name in JSON
  10. jsonarray = jsonobject.getJSONArray("Categorias");
  11.  
  12. for (int i = 0; i < jsonarray.length(); i++) {
  13. HashMap<String, String> map = new HashMap<String, String>();
  14. jsonobject = jsonarray.getJSONObject(i);
  15. // Retrive JSON Objects
  16. map.put("valoracionEmpresa", jsonobject.getString("valoracionEmpresa"));
  17. map.put("nombreEmpresa", jsonobject.getString("nombreEmpresa"));
  18. map.put("direccionEmpresa", jsonobject.getString("direccionEmpresa"));
  19. map.put("strImagen", jsonobject.getString("strImagen"));//<--- THIS IS THE IMAGE FILE NAME
  20. // Set the JSON Objects into the array
  21. arraylist.add(map);
  22. }
  23. } catch (JSONException e) {
  24. Log.e("Error", e.getMessage());
  25. e.printStackTrace();
  26. }
  27. return null;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement