ActionBarSherlock + Google Maps API v2 Duplicate Identifier

I am trying to integrate an ActionBarSherlock with fragments of the Google Maps v2 API.

I have a layout with two snippets: one for the list layout, and the other with SupportMapFragment support.

When I click on a list item, do it well first, but when I click on a list item a second time, it gives an error: "Duplicate id 0x7f040038, tag null or parent id 0x0 with another snippet for com.google.android.gms.maps. SupportMapFragment "

I tried several solutions and none of them could fix it. Is there something I'm doing wrong? Please help me!

I modified the ActionBarSherlock to include SherlockMapFragment to support the new SupportMap (as shown here: https://gist.github.com/4392030 ).

This is my code: https://github.com/inigo-jimenez/TestGoogleMaps

+7
source share
2 answers

This is not a problem with ActionBarSherlock, but broader if you have SupportMapFragment inside your custom fragment.

You need to use getChildFragmentManager () to add SupportMapFragment, not through xml.

Take a look at my answer here: MapFragment in Fragment, alternatives?

+1
source

Extract the identifier from the element list fragment in the XML file.

Then place the fragment inside the container layout (LinearLayout). If you need to reference a fragment, go through this layout.

Make sure you use the onCreateView function and not onCreate inside the fragment class.

0
source

All Articles