2012-05-08 32 views
0

我有一個大問題,我一直在網上搜索有這個問題的一個很好的解決方案,但我找不到任何方法解決此問題,所以我需要幫助。可擴展ListView與JSON數據在android

我需要使用可擴展列表視圖從服務器(JSON陣列)獲取數據,我有類別GroupData及其項目ChildData。我不知道如何獲得每個父組的子數據...我需要類似SimpleCursorTreeAdapter但我沒有找到任何東西。

這是我達到到現在,但它不工作,請幫助我:

 static ArrayList<HashMap<String, String>> mapList = 
      new ArrayList<HashMap<String, String>>(); 
    static ArrayList<HashMap<String, String>> catItemsList = 
      new ArrayList<HashMap<String, String>>(); 
    static ArrayList<ArrayList<HashMap<String, String>>> ItemsList = 
      new ArrayList<ArrayList<HashMap<String, String>>>(); 
    static ListView order_list; 
    static ExpandableListView order_items_list; 
    static SimpleAdapter adapter,ItemsAdapter; 


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=?? 

     JSONObject params = new JSONObject(); 
     //int no_pepole=Integer.valueOf(noOfGest_txt.getText().toString()); 
      try 
      { 
     // params.put("order_status",myStatus); 
     int rest_id=prefs.getInt("Rest_id", 0); 
      params.put("order_id", order_id); 
      params.put("lang_id", 1); 
      params.put("rest_id", rest_id); 
      //params.put("order_status", 0); 
     // params.put("noOfpepole",number_of_guest); 
      } 
      catch(Exception e) 
      { 
       e.printStackTrace(); 
      } 



     String Url="http://192.168.3.113/mywebservices.php?op=GetOrderCategory"; 
     GetNetworkData.OnPostExecuteListener listener=new GetNetworkData.OnPostExecuteListener() 
     { 

      @Override 
      public void onPostExecute(String result) { 
       // TODO Auto-generated method stub 
       if (result!=null) 
       { 
        try 
        { 
        catItemsList.clear(); 
       JSONArray jArray = new JSONArray(result); 
       ArrayList<ArrayList<HashMap<String, String>>> list=new ArrayList<ArrayList<HashMap<String, String>>>(); 
       // ArrayList<Integer> category=new ArrayList<Integer>(); 

       for (int i = 0; i < jArray.length(); i++) 

        { 
         HashMap<String, String> Catmap = new HashMap<String, String>(); 

         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", "order ID "+order_id); 

          list= BindCatItems(cat_id, order_id); 
         Log.i("Insid For Loop", "Child size = "+list.size()); 
        } 
       // Log.i("Insid For Loop", "Group size = "+catItemsList.size()); 


       SimpleExpandableListAdapter expandListAdapter= new SimpleExpandableListAdapter(getActivity(), 
         catItemsList, R.layout.group_item, 
          new String[] {"cat_name"},new int[]{R.id.lbl_cat_group}, 
          list, R.layout.category_row, new String[]{"item_name"}, new int[]{R.id.txt_category_row}); 


       order_items_list.setAdapter(expandListAdapter); 
         // Log.i("Bind item", "CAT SIZE "+catItemsList.size()); 

         } 
        catch(Exception e) 
        { 
         e.printStackTrace(); 
        } 
       } 

      } 

     }; 

     try 
     { 
     GetNetworkData task = new GetNetworkData(Url,params,listener); 
     task.execute(); 
     } 
     catch(Exception e) 
     { 

      e.printStackTrace(); 

     } 
    } 

    protected ArrayList<ArrayList<HashMap<String, String>>> BindCatItems(int cat_id,int order_id) 

    { 
     // TODO Auto-generated method stub 

     JSONObject params = new JSONObject(); 
     //int no_pepole=Integer.valueOf(noOfGest_txt.getText().toString()); 
      try 
      { 
     // params.put("order_status",myStatus); 
     int rest_id=prefs.getInt("Rest_id", 0); 
      params.put("order_id", order_id); 
      params.put("lang_id", 1); 
      params.put("cat_id",cat_id); 
      //params.put("order_status", 0); 
     // params.put("noOfpepole",number_of_guest); 
      } 
      catch(Exception e) 
      { 
       e.printStackTrace(); 
      } 


     String Url="http://192.168.3.113/mywebservices.php?op=GetOrderItems"; 
     GetNetworkData.OnPostExecuteListener listener=new GetNetworkData.OnPostExecuteListener() 

     { 

      @Override 
      public void onPostExecute(String result) { 
       // TODO Auto-generated method stub 
       if (result!=null) 
       { 
        try 
        { 
         Log.i("log bind","Inside Bind Category items"); 
         // catItemsList.clear(); 
         mapList.clear(); 
         JSONArray jArray = new JSONArray(result); 

          for (int i = 0; i < jArray.length(); i++) 
          { 
           HashMap<String, String> map = new HashMap<String, String>(); 
           JSONObject e = jArray.getJSONObject(i); 

           int id=e.getInt("item_id"); 
           if (id==0) 
           { 

           } 


           else 
           { 

           map.put("item_id",String.valueOf(e.getInt("item_id"))); 
           map.put("oi_id", String.valueOf(e.getInt("oi_id"))); 
           map.put("item_name", e.getString("item_name")); 
           map.put("quantity",String.valueOf(e.getString("quantity"))); 
           map.put("price", String.valueOf("price")); 
         mapList.add(map); 

           } 
          } 
          ItemsList.add(mapList); 
         // Log.i("Bind Item Order", "CAT SIZE "+catItemsList.size()); 



          /* ItemsAdapter=new SimpleAdapter(getActivity(), catItemsList, 
            R.layout.list_item, 
            new String[] {"item_name"}, 
            new int[]{R.id.list_item_title}); 
          */ 
          // Log.i("Add Section","ItemsAdapter count= "+ItemsAdapter.getCount()); 


          //order_list.setAdapter(adapter); 
          //adapter.notifyDataSetChanged(); 
        } 
        catch(Exception e) 
        { 
         e.printStackTrace(); 
        } 
       } 
      } 
     }; 

     try 
     { 
     GetNetworkData task = new GetNetworkData(Url,params,listener); 
     task.execute(); 
     } 
     catch(Exception e) 
     { 

      e.printStackTrace(); 

     } 
     return ItemsList; 


    } 
+0

你可以讓你的JSON的豆子,並將它們添加到ArrayList的這種方式,您將不得不JST一個列表使用更新childView和groupView。childView和parentview的工作方式與適配器的getView相同,用於ListView –

+0

能否請你解釋更多關於(你的json的bean),並給我一個例子 – Basant

回答

2

根據文檔,SimpleExpandableListAdapter用於靜態數據。這裏發生的情況可能是您的方法在獲取數據之前返回,並且在已經創建適配器之後調用傳遞給AsyncTask的偵聽器。

因此,我建議嘗試的第一件事是首先獲取數據,一旦執行兩個偵聽器(通過檢查自己定義的布爾標誌或列表的長度),定義適配器並將其傳遞給列表顯示。

+0

好吧,我會嘗試你的建議,但停止的東西我是如何爲小組獲得孩子..我的意思是,如果我有四個組ID(1,2,3,4)如何讓其孩子在父母ID = 1和2,...等等。你明白了我的觀點。現在我只有列表該組但它的孩子沒有綁定 – Basant

+0

這取決於你的用例。 如果整個列表及其孩子必須在場,那麼您必須循環訪問所有類別的孩子。 (我在你的代碼中注意到的另一件事,子項應該是列表的列表,每個組的列表)。 如果用戶更有可能只擴展一個或兩個組,那麼也許您應該創建一個自定義適配器並在僅擴展組時才加載子組。 –

+0

什麼是列表的名單可以給我一個例子因爲我現在有這個異常05-08 13:38:42.660:E/AndroidRuntime(31012):java.lang.ClassCastException:無法投射java.util.HashMap到java.util.List – Basant

0

我把你在這裏我使用lisview處理兩個json的解決方案;

public class ListViewer extends ListActivity{ 
    //Primary URL JSON1 
    private static String url0 = "http:/a.com/url"; 
    //URL JSON2 
    private static String url2 = "http:/a.com/url"; 

    //JSON1 Node names 
    public static final String TAG_COURSES1 = "Courses";   //JSONArray from json1 
    public static final String TAG_COURSEID1 = "CourseId";   //Object from json1 - Array courses 
    public static final String TAG_RATING1 = "Rating";    //Object from json1 - Array courses 
    public static final String TAG_STATUS1 = "Status";    //Object from json1 - Array courses 
    // JSON2 Node names 
    public static final String TAG_COURSES2 = "Courses";   //JSONArray from json2 
    public static final String TAG_COURSEID2 = "CourseId";   //Object from json2 - Array courses 
    public static final String TAG_TITLE = "title";    //Object from json2 - Array courses 
    public static final String TAG_INSTRUCTOR = "instructor";  //Object from json2 - Array courses 
    public static final String TAG_LENGTH = "length";    //Object from json2 - Array courses 
    public static final String TAG_RATING2 = "Rating";    //Object from json2 - Array courses 
    public static final String TAG_SUBJECT = "subject";   //Object from json2 - Array courses 
    public static final String TAG_DESCRIPTION = "description"; //Object from json2 - Array courses 
    public static final String txt_instructor = "Instructor: "; 
    public static final String txt_length = "Length: "; 
    public static final String txt_minutes = "minutes"; 

    //Course JSONArray's from json1 & json2 = null, for now. 
    JSONArray Courses1 = null; 
    JSONArray Courses2 = null; 

    //Lists 
    public ListView list1; 
    public ListView list2; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.lay_main); 

     // Hashmap for ListView 
     ArrayList<HashMap<String, String>> coursesList1 = new ArrayList<HashMap<String, String>>(); 
     ArrayList<HashMap<String, String>> coursesList2 = new ArrayList<HashMap<String, String>>(); 
     //Getting bundles 3 & 4, from MariposaTrainingActivity.class... 
     Bundle bundle1 = getIntent().getExtras(); 
     String userName=bundle1.getString("UN"); //Getting the userName 
     Bundle bundle2 = getIntent().getExtras(); 
     String password=bundle2.getString("PW"); //Getting the passord 
     String UR = "UserName=";     //String for build the url1, for the request json1. 
     String QTE = "&";       //String for build the url1, for the request json1. 
     String PW = "Password=";     //String for build the url1, for the request json1. 
     //Building the URL to get the json1. 
     String url1 = url0 + UR + userName + QTE + PW + password; 

     // Creating JSON Parser instance (json1) 
     JSONParser2 jParser1 = new JSONParser2(); 
     // getting JSON string from URL (json1) 
     final JSONObject json1 = jParser1.getJSONFromUrl(url1); 

     // Creating JSON Parser instance (json2) 
     JSONParser2 jParser2 = new JSONParser2(); 
     // getting JSON string from URL (json2) 
     final JSONObject json2 = jParser2.getJSONFromUrl(url2);           

       try {   
        // Getting The Array "Courses" from json1 & json2 
        Courses1 =json1.getJSONArray(TAG_COURSES1); 
        Courses2 = json2.getJSONArray(TAG_COURSES2); 
        int x = 1; 
        //LOOP FOR JSON1 
        for(int i = 0; i < Courses1.length(); i++){ 
         //LOOP FOR JSON2 
         for(int ii = 0; ii < Courses2.length(); ii++){ 
          JSONObject courses1 = Courses1.getJSONObject(i); 
          JSONObject courses2 = Courses2.getJSONObject(ii); 

          // Storing each json1 item in variable 
          int courseID1 = courses1.getInt(TAG_COURSEID1); 
          //Log.e("COURSEID1:", Integer.toString(courseID1)); 
          String Rating1 = courses1.getString(TAG_RATING1); 
          int Status1 = courses1.getInt(TAG_STATUS1); 
          //Log.e("Status1:", Integer.toString(Status1));  //Put the actual value for Status1 in log.    

          // Storing each json2 item in variable 
          int courseID2 = courses2.getInt(TAG_COURSEID2); 
          //Log.e("COURSEID2:", Integer.toString(courseID2)); //Put the actual value for CourseID2 in log 
          String Title2 = courses2.getString(TAG_TITLE);      
          String instructor2 = courses2.getString(TAG_INSTRUCTOR); 
          String length2 = courses2.getString(TAG_LENGTH); 
          String rating2 = courses2.getString(TAG_RATING2); 
          String subject2 = courses2.getString(TAG_SUBJECT); 
          String description2 = courses2.getString(TAG_DESCRIPTION); 

          //Status1 = 5 from json1; Incomplete, Status1 =-1 Complete 
          if(courseID2 == courseID1){    
          int x1 = x++; //Get the count for All values. 
          //Log.e("x=", Integer.toString(x1)); //Show the value in Logcat. 
          // Get pairs/odds. 
          int Num = x1 % 2; 
          //Log.e("Num=", Integer.toString(Num)); // 
          //Creating new HashMap 
          HashMap<String, String> map = new HashMap<String, String>(); 
          HashMap<String, String> map2 = new HashMap<String, String>(); 
          if(Num==1){ 

            map.put(TAG_COURSEID2, Integer.toString(courseID2)); 
            map.put(TAG_TITLE, Title2); 
            map.put(txt_instructor, "Instructor: "); 
            map.put(TAG_INSTRUCTOR, instructor2); 
            map.put(txt_length, "Length: "); 
            map.put(TAG_LENGTH, length2); 
            map.put(txt_minutes, " minutes"); 
            map.put(TAG_RATING2, rating2); 
            map.put(TAG_SUBJECT, subject2); 
            map.put(TAG_DESCRIPTION, description2); 

            //adding HashList to ArrayList 
            coursesList1.add(map); 
          } 
          if(Num==0) 
          { 

            map2.put(TAG_COURSEID2, Integer.toString(courseID2)); 
            map2.put(TAG_TITLE, Title2); 
            map2.put(txt_instructor, "Instructor: "); 
            map2.put(TAG_INSTRUCTOR, instructor2); 
            map2.put(txt_length, "Length: "); 
            map2.put(TAG_LENGTH, length2); 
            map2.put(txt_minutes, " minutes"); 
            map2.put(TAG_RATING2, rating2); 
            map2.put(TAG_SUBJECT, subject2); 
            map2.put(TAG_DESCRIPTION, description2); 

            //adding HashList to ArrayList 
            coursesList2.add(map2); 
          } 
          }//if 
         }//for2 (json2) 
        } //for1 (json1)     
       }//Try 
        catch (JSONException e) { 
        e.printStackTrace();     
        } 

     ListAdapter adapter2 = new SimpleAdapter(this, coursesList2, 
       R.layout.list_courses_2, 
       new String[] { TAG_COURSEID2, TAG_TITLE, txt_instructor, TAG_INSTRUCTOR, txt_length, TAG_LENGTH, txt_minutes, TAG_RATING2, TAG_SUBJECT, TAG_DESCRIPTION }, new int[] { 
         R.id.txt_courseid_r2, R.id.txt_title_r2, R.id.txt_text_instructor_r2, R.id.txt_instructor_r2, R.id.txt_text_length_r2,R.id.txt_length_r2, R.id.txt_text_minutes_r2,R.id.txt_rating_r2, R.id.txt_topic_r2, R.id.txt_description_r2 }); 
     setListAdapter(adapter2); 
     colectorXML2(); 
     list2.setAdapter(adapter2); 

     list2.setOnItemClickListener(new OnItemClickListener() { 


      public void onItemClick(AdapterView<?> parent, View view, 
        int position, long id) { 

       // getting values from selected ListItem 
       String courseID = ((TextView) view.findViewById(R.id.txt_courseid_r2)).getText().toString(); 
       String Title = ((TextView) view.findViewById(R.id.txt_title_r2)).getText().toString(); 
       String instructor = ((TextView) view.findViewById(R.id.txt_instructor_r2)).getText().toString(); 
       String length = ((TextView) view.findViewById(R.id.txt_length_r2)).getText().toString(); 
       String rating = ((TextView) view.findViewById(R.id.txt_rating_r2)).getText().toString(); 
       String subject = ((TextView) view.findViewById(R.id.txt_topic_r2)).getText().toString(); 
       String description = ((TextView) view.findViewById(R.id.txt_description_r2)).getText().toString(); 

       // Starting new intent 
       Intent in = new Intent(getApplicationContext(), SingleListItem.class); 

       in.putExtra(TAG_COURSEID2, courseID); 
       in.putExtra(TAG_TITLE, Title); 
       in.putExtra(TAG_INSTRUCTOR, instructor); 
       in.putExtra(TAG_LENGTH, length); 
       in.putExtra(TAG_RATING2, rating); 
       in.putExtra(TAG_SUBJECT, subject); 
       in.putExtra(TAG_DESCRIPTION, description); 
       startActivity(in); 
      } 
     });//lv.SetOnclickListener 

     ListAdapter adapter = new SimpleAdapter(this, coursesList1, 
       R.layout.list_courses, 
       new String[] { TAG_COURSEID2, TAG_TITLE, txt_instructor, TAG_INSTRUCTOR, txt_length, TAG_LENGTH, txt_minutes, TAG_RATING2, TAG_SUBJECT, TAG_DESCRIPTION }, new int[] { 
         R.id.txt_courseid, R.id.txt_title, R.id.txt_text_instructor, R.id.txt_instructor, R.id.txt_text_length,R.id.txt_length, R.id.txt_text_minutes,R.id.txt_rating, R.id.txt_topic, R.id.txt_description }); 
     colectorXML();  
     list1.setAdapter(adapter); 

     // Launching new screen on Selecting Single ListItem 
     list1.setOnItemClickListener(new OnItemClickListener() { 

      public void onItemClick(AdapterView<?> parent, View view, 
        int position, long id) { 

       // getting values from selected ListItem 
       String courseID = ((TextView) view.findViewById(R.id.txt_courseid)).getText().toString(); 
       String Title = ((TextView) view.findViewById(R.id.txt_title)).getText().toString(); 
       String instructor = ((TextView) view.findViewById(R.id.txt_instructor)).getText().toString(); 
       String length = ((TextView) view.findViewById(R.id.txt_length)).getText().toString(); 
       String rating = ((TextView) view.findViewById(R.id.txt_rating)).getText().toString(); 
       String subject = ((TextView) view.findViewById(R.id.txt_topic)).getText().toString(); 
       String description = ((TextView) view.findViewById(R.id.txt_description)).getText().toString(); 

       // Starting new intent 
       Intent in = new Intent(getApplicationContext(), SingleListItem.class); 

       in.putExtra(TAG_COURSEID2, courseID); 
       in.putExtra(TAG_TITLE, Title); 
       in.putExtra(TAG_INSTRUCTOR, instructor); 
       in.putExtra(TAG_LENGTH, length); 
       in.putExtra(TAG_RATING2, rating); 
       in.putExtra(TAG_SUBJECT, subject); 
       in.putExtra(TAG_DESCRIPTION, description); 
       startActivity(in); 
      } 
     });//lv.SetOnclickListener  
    }//onCreate 

    private void colectorXML() { 
     list1 = (ListView)findViewById(android.R.id.list); 
    } 
    private void colectorXML2() { 
     list2 =(ListView)findViewById(R.id.list2); 
    } 
}// Activity 

只要把你的方法,你的JSON的信息,在這種情況下,你只是處理1個JSON,所以要休息...希望這給你的想法。

0

我從所有這些很好的幫助後仍無法解決問題,這裏是答案

 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=?? 

     JSONObject params = new JSONObject(); 
     //int no_pepole=Integer.valueOf(noOfGest_txt.getText().toString()); 
      try 
      { 
     // params.put("order_status",myStatus); 
     int rest_id=prefs.getInt("Rest_id", 0); 
      params.put("order_id", order_id); 
      params.put("lang_id", 1); 
      params.put("rest_id", rest_id); 
      //params.put("order_status", 0); 
     // params.put("noOfpepole",number_of_guest); 
      } 
      catch(Exception e) 
      { 
       e.printStackTrace(); 
      } 



     String Url="http://192.168.3.113/mywebservices.php?op=GetOrderCategory"; 
     GetNetworkData.OnPostExecuteListener listener=new GetNetworkData.OnPostExecuteListener() 
     { 

      @Override 
      public void onPostExecute(String result) { 
       // TODO Auto-generated method stub 
       if (result!=null) 
       { 
        try 
        { 
        catItemsList.clear(); 
       JSONArray jArray = new JSONArray(result); 
       ArrayList<ArrayList<HashMap<String, String>>> list=new ArrayList<ArrayList<HashMap<String, String>>>(); 
       // ArrayList<Integer> category=new ArrayList<Integer>(); 

       for (int i = 0; i < jArray.length(); i++) 

        { 
         HashMap<String, String> Catmap = new HashMap<String, String>(); 

         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", "order ID "+order_id); 

          list= BindCatItems(cat_id, order_id); 



         Log.i("Insid For Loop", "Child size = "+list.size()); 
        } 
       // Log.i("Insid For Loop", "Group size = "+catItemsList.size()); 

       SimpleExpandableListAdapter expandListAdapter= new SimpleExpandableListAdapter(getActivity(), 
          catItemsList, R.layout.group_item, 
          new String[] {"cat_name"},new int[]{R.id.lbl_cat_group}, 
          BindCatItems(cat_id, order_id), R.layout.category_row, new String[]{"item_name"}, new int[]{R.id.txt_category_row}); 


       order_items_list.setAdapter(expandListAdapter); 
         // Log.i("Bind item", "CAT SIZE "+catItemsList.size()); 

         } 
        catch(Exception e) 
        { 
         e.printStackTrace(); 
        } 
       } 

      } 

     }; 

     try 
     { 
     GetNetworkData task = new GetNetworkData(Url,params,listener); 
     task.execute(); 
     } 
     catch(Exception e) 
     { 

      e.printStackTrace(); 

     } 
    } 

    protected ArrayList<ArrayList<HashMap<String, String>>> BindCatItems(int cat_id,int order_id) 

    { 
     // TODO Auto-generated method stub 
     ItemsList.clear(); 
     JSONObject params = new JSONObject(); 

     //int no_pepole=Integer.valueOf(noOfGest_txt.getText().toString()); 
      try 
      { 
     // params.put("order_status",myStatus); 
     int rest_id=prefs.getInt("Rest_id", 0); 
      params.put("order_id", order_id); 
      params.put("lang_id", 1); 
      params.put("cat_id",cat_id); 
      //params.put("order_status", 0); 
     // params.put("noOfpepole",number_of_guest); 
      } 
      catch(Exception e) 
      { 
       e.printStackTrace(); 
      } 


     String Url="http://192.168.3.113/mywebservices.php?op=GetOrderItems"; 
     GetNetworkData.OnPostExecuteListener listener=new GetNetworkData.OnPostExecuteListener() 

     { 

      @Override 
      public void onPostExecute(String result) { 
       // TODO Auto-generated method stub 
       if (result!=null) 
       { 
        try 
        { 
         Log.i("log bind","Inside Bind Category items"); 
         // catItemsList.clear(); 
         ArrayList<HashMap<String, String>> mapList = 
            new ArrayList<HashMap<String, String>>(); 
         JSONArray jArray = new JSONArray(result); 

          for (int i = 0; i < jArray.length(); i++) 
          { 
           HashMap<String, String> map = new HashMap<String, String>(); 

           JSONObject e = jArray.getJSONObject(i); 

           int id=e.getInt("item_id"); 
           if (id==0) 
           { 

           } 


           else 
           { 



           map.put("item_id",String.valueOf(e.getInt("item_id"))); 
           map.put("oi_id", String.valueOf(e.getInt("oi_id"))); 
           map.put("item_name", e.getString("item_name")); 
           map.put("quantity",String.valueOf(e.getString("quantity"))); 
           map.put("price", String.valueOf("price")); 
         mapList.add(map); 

           } 
          } 

          ItemsList.add(mapList); 

         // Log.i("Bind Item Order", "CAT SIZE "+catItemsList.size()); 



          /* ItemsAdapter=new SimpleAdapter(getActivity(), catItemsList, 
            R.layout.list_item, 
            new String[] {"item_name"}, 
            new int[]{R.id.list_item_title}); 
          */ 
          // Log.i("Add Section","ItemsAdapter count= "+ItemsAdapter.getCount()); 


          //order_list.setAdapter(adapter); 
          //adapter.notifyDataSetChanged(); 
        } 
        catch(Exception e) 
        { 
         e.printStackTrace(); 
        } 
       } 
      } 
     }; 

     try 
     { 
     GetNetworkData task = new GetNetworkData(Url,params,listener); 
     task.execute(); 
     } 
     catch(Exception e) 
     { 

      e.printStackTrace(); 

     } 
     return ItemsList; 


    }