0
我嘗試用碎片的工作中,我創建BusModelActivity這種延伸ListFragment開放ListFragment
public class BusModelsActivity extends ListFragment {
String data [] = new String[]{"1","2","3","4"};
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,data);
setListAdapter(adapter);
}
}
,但我無法從其他活動找到它
Intent intent = new Intent(BusSearchParamActivity.this,BusModelsActivity.class);
startActivity(intent);
我得到:
android.content.ActivityNotFoundException: Unable to find explicit activity class {ru.avtobus66.finder_transport/ru.avtobus66.finder_transport.BusModelsActivity};
have you declared this activity in your AndroidManifest.xml?
但是當我嘗試添加到AndroidManifest文件它找不到我的活動。如何從活動運行ListFragment?
你不能從一個活動導航分割。按照我的答案。 –