I try to work with fragments, I create BusModelActivity such extends ListFragment

public class BusModelsActivity extends ListFragment {

String data [] = new String[]{"1","2","3","4"};

public void onActivityCreated(Bundle savedInstanceState) {
    ArrayAdapter<String> adapter =  new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,data);


but I can't navigate to it from other activity

Intent intent = new Intent(BusSearchParamActivity.this,BusModelsActivity.class);

I get:

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?

but when I try to add to AndroidManifest file It can't find my activity. How to run ListFragment from activity?

No correct solution


see you can attach a fragment to an activity.

like as :-

FragmentManager fm = getFragmentManager();  

  if (fm.findFragmentById( == null) {  
   BusModelsActivity list = new BusModelsActivity ();  
   fm.beginTransaction().add(, list).commit();  

And then after navigate like as follows:-

Intent intent = new Intent(BusSearchParamActivity.this,YourActivity.class);

and that activity should be present in the AndroidManifest.xml

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow