Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarSherlock + Google Maps API v2 Duplicate Id

I'm trying to integrate the ActionBarSherlock with Google Maps API v2 fragments.

I have a layout with 2 fragments: one for a list layout and another with a SupportMapFragment.

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

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

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

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

like image 988
elbirras Avatar asked Jan 23 '13 14:01

elbirras


1 Answers

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

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

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

like image 191
MaciejGórski Avatar answered Oct 23 '22 04:10

MaciejGórski