Note that there are some explanatory texts on larger screens.

plurals
  1. POExpandableListView with JSON array
    primarykey
    data
    text
    <p>If I want to have an ExpandableListView, which gets data from a response from server(JSON array) for its groups and their children.<br/> How can I do it?<br/> I know that there is SimpleCursorTreeAdapter, but it used only for cursor and I used it before, but I need any equivalent for this adapter to use it with JSON arrays</p> <p>This is the function to get the groupItems </p> <pre><code> protected void BindOrederItemList(final int order_id) { // TODO Auto-generated method stub //select all categories from order items where order_id =?? //select items where category=?? String Url="http://192.168.3.113/mywebservices.php?op=GetOrderCategory&amp;lang_id=1&amp;order_id="+order_id; GetNetworkData.OnPostExecuteListener listener=new GetNetworkData.OnPostExecuteListener() { @Override public void onPostExecute(String result) { // TODO Auto-generated method stub if (result!=null) { try { JSONArray jArray = new JSONArray(result); HashMap&lt;String, String&gt; Catmap = new HashMap&lt;String, String&gt;(); // ArrayList&lt;Integer&gt; category=new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; jArray.length(); i++) { JSONObject e = jArray.getJSONObject(i); id=e.getInt("order_id"); cat_name=e.getString("cat_name"); cat_id=e.getInt("cat_id"); Catmap.put("cat_id",String.valueOf(cat_id)); Catmap.put("cat_name", cat_name); catItemsList.add(Catmap); } Log.i("Insid For Loop", "Group size = "+catItemsList.toArray()); // Log.i("Bind item", "CAT SIZE "+catItemsList.size()); } catch(Exception e) { e.printStackTrace(); } } } }; try { GetNetworkData task = new GetNetworkData(Url,null,listener); task.execute(); } catch(Exception e) { e.printStackTrace(); } } </code></pre> <p>Thanks </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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