Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You set <strong>TIME</strong> to <strong>yourdata1</strong> and <strong>NAME</strong> to <strong>yourdata</strong>. The objects of <strong>yourdata1</strong> only contains TIME and the <strong>NAME is null</strong>. The objects of <strong>yourdata</strong> only contains NAME and the <strong>TIME is null</strong>.</p> <p>Please set NAME and TIME in <strong>one object</strong> and store it in <strong>one List</strong> which will be passed to ListAdapter.</p> <p>I hope you can understand me.</p> <pre><code> @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub // Creating JSON Parser instance JSONObjParser jParser = new JSONObjParser(); // getting JSON string from URL JSONArray json = jParser.getJSONFromUrl(url); // getting JSON string from URL JSONArray json1 = jParser.getJSONFromUrl(url1); // assume json's length is the same as json1's try { for (int i = 0; i &lt; json1.length(); i++) { JSONObject c = json1.getJSONObject(i); Item item = new Item(); // Storing each json item in variable int id = c.getInt("_id"); String TIME = c.getString("RestaurantTime"); item.setTime(TIME); c = json.getJSONObject(i); // Storing each json item in variable String NAME=c.getString("restaurantNAME"); item.setName(NAME); yourData.add(item); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } </code></pre> <p>and</p> <pre><code>public class Item{ private String Name; private String Time; public String getName() { return Name; } public void setName(String name) { Name = name; } public String getTime() { return Time; } public void setTime(String time) { Time = time; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload