I've got a problem with the google map object in the new v2 API. I'm trying to add methods to show and hide the map object, but I can't seem to get it to work.
For example - I have a class called MyMapFragment which extends the MapFragment class.
I've tried a couple of ways which I've seen posted here, but neither seem to work for me.
Option 1: Inside the MyMapFragment class, I've tried calling:
this.getFragmentManager().beginTransaction().hide(this).commit();
Option 2: I've tried to hide the actual containing view, using something like the following:
getActivity().getWindow().findViewById(CONTENT_VIEW_ID);
v.setVisibility( View.INVISIBLE );
Both of these options hide the UI controls (i.e. the zoom controls) of the map successfully, but the actual map does not get hidden.
Does anyone see what may be wrong with this method of hiding the map fragment?
Help muchly appreciated!
Try to put it in the FrameLayout and then assign id to the layout and show/hide the whole layout with the method .setVisibility(View.GONE/View.VISIBLE)
Not sure if it's the correct way but it works for me.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With