2013-08-23 23 views
0

在互聯網上衝浪我沒有發現任何關於這個論點除了這個問題在這個網站上:here問題是,我的代碼是好的,但列表不顯示。這是我的代碼:片段中的SimpleAdapter不顯示多列列表

@Override 
    public void onActivityCreated(Bundle savedInstanceState) { 
    super.onActivityCreated(savedInstanceState); 
    id = getArguments().getString("id"); 
    mylist = new ArrayList<HashMap<String, String>>(); 
    new MyAsyncTask().execute(); //popolate the mylist 
    mSchedule = new SimpleAdapter(getActivity(), mylist, R.layout.rowlinerepair, 
      new String[] {"type", "description", "qta", "price"}, new int[] {R.id.Type, R.id.Description, R.id.Qta, R.id.Totale}); 
    setListAdapter(mSchedule); 
    } 

我使用的是ListFragment,但在Fragment中是一樣的。我需要這個,因爲我正在創建一個多列列表。謝謝

回答

0

我解決了。在postExecute中插入:

mSchedule = new SimpleAdapter(getActivity(), mylist, R.layout.rowlinerepair, 
     new String[] {"type", "description", "qta", "price"}, new int[] {R.id.Type, R.id.Description, R.id.Qta, R.id.Totale}); 
setListAdapter(mSchedule);