2015-08-22 269 views
1

當我運行我的應用程序時,我的虛擬設備停留在加載屏幕上,我認爲這是我在主要活動中實現的片段。該片段僅包含三個項目的列表。Android Studio:虛擬設備

Java代碼:

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 

    View view = inflater.inflate(R.layout.roomiemenu,container,false); 
    String[] menu = {"Manage Roomies","Calender","Transfers"}; 
    ListAdapter menuAdapter = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_list_item_1,menu); 
    ListView roomieLM = (ListView) view.findViewById(R.id.roomieLM); 
    roomieLM.setAdapter(menuAdapter); 
    return view; 
} 

回答

0

只有佈局在onCreateView充氣()方法。並創建適配器並將其設置爲在onActivityCreated()內部列出。