2012-05-08 12 views
0

私は大きな問題があります。この問題の良い解決方法をWebで検索していますが、この問題の解決策を見つけることができませんでした。androidのJSONデータで展開可能なListView

サーバー(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の豆を作り、あなたがJSTつのリストを使用する必要がありますこの方法をArrayListにそれらを追加することができますchildViewとgroupViewを更新します。childViewとparentviewは、ListViewのアダプタからgetViewと同じ方法で動作します –

+0

あなたのjsonの豆についてもっと詳しく説明してください。 – Basant

答えて

2

ドキュメントによると、SimpleExpandableListAdapterは静的データ用です。おそらくここで起こっていることは、データがフェッチされる前にメソッドが返ってきて、アダプタが既に作成された後にAsyncTaskに渡されたリスナーが呼び出されるということです。

最初にデータをフェッチすることをお勧めします.2つのリスナーが実行されると(独自のブール値フラグやリストの長さをチェックして)、アダプタを定義してリストビュー。

+0

ok私はあなたにお勧めしますが、私はグループのための子供を得る方法です..私はIDを持つ4つのグループを持っている場合(1,2,3,4)親ID = 1と2、その子を取得する方法...とso.doあなたは私のポイントを持っています。グループがそれは子供がバインドされていない – Basant

+0

あなたのユースケースによって異なります。 子を持つリスト全体が存在する必要がある場合は、すべてのカテゴリの子をループ内にフェッチする必要があります。 (私があなたのコードに書いた別のこと、子アイテムはリストのリスト、各グループのリストでなければなりません)。 ユーザーが1つまたは2つのグループのみを展開する可能性が高い場合は、カスタムアダプターを作成し、グループが展開されているときに子を読み込む必要があります。 –

+0

リストのリストの意味は何ですか私に今この例外がありますか?05-08 13:38:42.660:E/AndroidRuntime(31012):java.lang.ClassCastException:java.util.HashMapをキャストできませんto java.util.List – Basant

0

私はここにlisviewを使用してハンドル2つの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; 


    } 
関連する問題