I have a simple list adapter in which I want to display food images with some text info. Till now I have known that I can do it with libraries like AQuery or Picasso, but I can't figure it out how to implement it after reading a lot of tutorials.
I have added Picasso library in my dependencies. Suppose my Image view id is ImgViewFood
activity
JSONArray jsonArr = jsonObj.getJSONArray("foodnames");
for (int i = 0; i < jsonArr.length(); i++) {
HashMap<String, String> food = new HashMap<>();
JSONObject jsonObj = jsonArr.getJSONObject(i);
String name = jsonObj.getString("food_name");
String url = jsonObj.getString("img_url");
food.put("foodname", name);
foodList.add(food);
}
ListAdapter adapter = new SimpleAdapter(
FoodListActivity.this, foodList,
R.layout.list_food_detail, new String[]{"foodname"}, new int[]{R.id.view_food_name});
listviewFood.setAdapter(adapter);