You have to start an Activity ( FragmentActivity
) since this is what the Fragment
can contain, a Fragment
can not be isolated from an Activity.
Simply perform the Fragment
transaction that you want when you start the onCreate()
method of the FragmentActivity.
// Carga nuevo fragmento deseado mediante una transacción.
Fragment nuevoFragmento = new myFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, nuevoFragmento);
transaction.addToBackStack(null);
// Commit a la transacción
transaction.commit();