I'm trying to replace a Fragment
when I click on a item List, the thing is that I've got the same code for 5 differents fragments
and it works on all, only on this Fragment
says :
java.lang.IllegalArgumentException: No view found for id 0x7f090022 (info.androidhive.slidingmenu:id/frame_container) for fragment DetallProductePerTipus{3899b306 #1 id=0x7f090022}
It says the frame_container
is not found... This is how I do the replace :
Bundle bundle = new Bundle();
android.support.v4.app.Fragment fragment = new DetallProductePerTipus();
bundle.putString("titol", item.title);
fragment.setArguments(bundle);
getFragmentManager().beginTransaction()
.replace(R.id.frame_container, fragment).commit();
I had problems with transaction with Fragments v4
and not v4
, and then I tried also this :
Bundle bundle = new Bundle();
Fragment fragment = new DetallProductePerTipus();
bundle.putString("titol", item.title);
fragment.setArguments(bundle);
getFragmentManager().beginTransaction()
.replace(R.id.frame_container, fragment).commit();
but it still doesn't work...
What I'm doing wrong?
On the same Fragment
I've got this code that makes a replace of a Fragment
, I want the same but adding the Bundle
.
android.support.v4.app.FragmentManager fm = getActivity().getSupportFragmentManager();
android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.frame_container, new ListaProductosFragment());
ft.commit();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…