Note that there are some explanatory texts on larger screens.

plurals
  1. POMapFragment in Fragment, alternatives?
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <blockquote> <p>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</p> <p>at android.app.Activity.onCreateView(Activity.java:4252)</p> <p>at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)</p> </blockquote> <p>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.</p> <p>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 :)</p> <p>Thanks</p> <p>Edit : Here is the code to change Fragment in the main Activity</p> <pre><code>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; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload