javaandroidandroid-fragmentsgoogle-maps-android-api-2child-fragment

Android Google Map API V2 blank screen with nested fragments


I'm working on an android app with an advanced integration of Google Maps API V2. I'm using SupportFragment and everything worked fine until I started to put the map in an further child fragment - there is a deep fragment hierarchy:

SplitViewFragment->RightChildFragment->ViewPagerFragment->SupportMapFragment

I want to achieve a special layout for tablets, so it is not possible to remove one fragment level.

So far, so good - everything is working very well on Android 4.3+ Devices but on lower API levels, the map fragment always remains blank/transparent - the google logo and the zoom controls are visible. There is no logcat error. Google Map is working on the same device when I remove one nested fragment; so it's not an authentication problem, as often described.

I also tried to initialize the MapFragment with zOrderOnTop without success:

GoogleMapOptions options = new GoogleMapOptions(); options.zOrderOnTop(true); SupportMapFragment mapFragment = SupportMapFragment.newInstance(options);

I spent two complete days on trying to find an answer for this problem and did an extensive research - without success.

I'm so looking forward to your answers. Thanks a million!


Solution

  • Unbelievable - I have an animation view in hierarchy with hardware acceleration - I removed the acceleration for API Levels < 18 as there is a problem with clipPath:

    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    

    I fixed it by removing the deactivation of the hardware acceleration. I've to find another solution to be able to deactive the hardware acceleration.

    Thanks a lot for your help.