Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected Void doInBackground(Void... params) {
- // Create an array
- arraylist = new ArrayList<HashMap<String, String>>();
- // Retrieve JSON Objects from the given URL address
- jsonobject = JSONfunctions
- .getJSONfromURL("http://.../android_ofertaslist_todas.php");
- try {
- // Locate the array name in JSON
- jsonarray = jsonobject.getJSONArray("Categorias");
- for (int i = 0; i < jsonarray.length(); i++) {
- HashMap<String, String> map = new HashMap<String, String>();
- jsonobject = jsonarray.getJSONObject(i);
- // Retrive JSON Objects
- map.put("valoracionEmpresa", jsonobject.getString("valoracionEmpresa"));
- map.put("nombreEmpresa", jsonobject.getString("nombreEmpresa"));
- map.put("direccionEmpresa", jsonobject.getString("direccionEmpresa"));
- map.put("strImagen", jsonobject.getString("strImagen"));//<--- THIS IS THE IMAGE FILE NAME
- // Set the JSON Objects into the array
- arraylist.add(map);
- }
- } catch (JSONException e) {
- Log.e("Error", e.getMessage());
- e.printStackTrace();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement