2012-07-12 97 views
1

什么我需要从片段1来电强制片段2的更新/刷新时片段2 onActivityCreated()有代码加载数据,创建一个自定义阵列适配器和设置它在一个ListView?更新/刷新列表视图

是否有更新/刷新ListView的方法,或者意图使Replace() Fragment强制重构并重新运行代码onActivityCreated()

这里是片段2 onActivityCreated()代码的文档片断:

@Override 
    public void onActivityCreated(Bundle savedInstanceState) 
    { 
     super.onActivityCreated(savedInstanceState); 

     // Get the prepared data and load it into this view 
     ArrayList<ReportData> oReportResultsData = Report.LoadData(Home.ScheduleJSonData,   Home.SelectedDate); 

     //Set the list into the gridview (Listview formatted with rows/columns) 
     ScheduledActivityReportGridArrayAdapter myGridArrayAdapter = new   ScheduledActivityReportGridArrayAdapter(this.getActivity(), R.layout.homeschedulerow, oReportResultsData); 
     lstReport.setAdapter(myGridArrayAdapter); 
    } 

我也尝试手动呼吁片段经理notifyDataSetChanged(),希望这将迫使它重新加载/刷新片段2.我有重读我还没有看到解决在onActivityCreated()的文档和许多伟大的答案在这里,但自定义LoadData()方法和自定义适配器被加以设定。

非常感谢!

+0

在这个不断解决?我正面临类似的问题 – Ethan 2013-01-06 23:55:37

回答