I need your help... I work on it until 3 days. My app is working with fragments.
One of these fragments has to display a map from the Google Maps V2 api for Android.
Currently, I'm using a MapFragment, but no surprise, a fragment in a fragment is not a good idea, but it works, the map is displaying, i can edit it but when I switch of main fragment and return on it.
Caused by: java.lang.IllegalArgumentException: Binary XML file line #59: Duplicate id 0x7f070041, tag null, or parent id 0x7f070040 with another fragment for com.google.android.gms.maps.MapFragment
at android.app.Activity.onCreateView(Activity.java:4252)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
This is the cause when I go on another fragment and return to the one which contains the map.
I'm searching until 3 days to fix this but no great results.
To resume for you, I've an Activity which calls a fragment which contains a MapFragment in the layout file.
If you need more, just ask :)
Thanks
Edit :
Here is the code to change Fragment in the main Activity
private void swtichFragment(Fragment fragment, Bundle bundle)
{
fragment.setBundle(this, bundle);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.rightFragmentPlaceHolder, fragment);
fragmentTransaction.commit();
mRightFragment = fragment;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…