this is my code and it's working good. i want to get multiple values (including image address) from my JSON data and show them in each row of my listview but i couldn't do that i just could get one data (title) and put that in simple list, how i can replace android.R.layout.simple_list_item_1 with my own single row layout? i'm new to android and i couldn't understand wheres the loop of listviews and rows.
what i wanna do is get some datas from JSON and show them in my custom row layout, something like google plus list view, with images, title and description
sorry for my bad english:)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
setContentView(R.layout.activity_read_restaurants);
restaurantList = (ListView) findViewById(R.id.restaurantList);
final ArrayAdapter<String> restaurantAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,restaurantArray);
restaurantList.setAdapter(restaurantAdapter);
RequestQueue rq = Volley.newRequestQueue(this);
JsonObjectRequest jsonrequest = new JsonObjectRequest(Request.Method.GET,feedURL,null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray restaurants = response.getJSONArray("posts");
for (int i =0; i<restaurants.length(); i++){
restaurantArray.add(restaurants.getJSONObject(i).getString("title"));
}
} catch (JSONException e) {
e.printStackTrace();
}
restaurantAdapter.notifyDataSetChanged();
}
},new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, error.toString(), Toast.LENGTH_LONG).show();
}
});
rq.add(jsonrequest);
}