issue with NoSaveStateFramelayout
<p>I am developing one application in whcih i Have integerate Sherlock Actionbar with Fragment.there are two tab, First is Map and Second is For Listing. For First Map tab I want to Put MapsForge opensource library base Map in this First Tab.I have got Example for MapsForge with Fragment from <a href="https://github.com/JakeWharton/Android-MapForgeFragment" rel="nofollow">GIt from Here</a>and i have tried to implement it.but it getting me Error of <code>NoSaveStateFramelayout</code></p>

<p><strong>Error ::</strong></p>

<pre><code>12-03 18:48:49.210: E/AndroidRuntime(2779): FATAL EXCEPTION: main
12-03 18:48:49.210: E/AndroidRuntime(2779): java.lang.ClassCastException: android.support.v4.app.NoSaveStateFrameLayout cannot be cast to com.jakewharton.android.mapsforge_fragment.MapView
12-03 18:48:49.210: E/AndroidRuntime(2779):     at in.wptrafficanalyzer.actionbarsherlocknavtab.MapFragment.getView(MapFragment.java:32)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at in.wptrafficanalyzer.actionbarsherlocknavtab.MapFragment.getView(MapFragment.java:1)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.support.v4.app.FragmentPagerAdapter.isViewFromObject(FragmentPagerAdapter.java:147)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.support.v4.view.ViewPager.infoForChild(ViewPager.java:1258)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.support.v4.view.ViewPager.populate(ViewPager.java:1031)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.support.v4.view.ViewPager.populate(ViewPager.java:881)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1366)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.View.measure(View.java:12775)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:594)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:376)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.View.measure(View.java:12775)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4709)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.View.measure(View.java:12775)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:822)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:563)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.View.measure(View.java:12775)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4709)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2240)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.View.measure(View.java:12775)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1117)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2505)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.os.Looper.loop(Looper.java:137)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at android.app.ActivityThread.main(ActivityThread.java:4514)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at java.lang.reflect.Method.invokeNative(Native Method)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at java.lang.reflect.Method.invoke(Method.java:511)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
12-03 18:48:49.210: E/AndroidRuntime(2779):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p><strong>Code:</strong></p>

<p><strong>MapFragment :</strong></p>

<pre><code>package in.wptrafficanalyzer.actionbarsherlocknavtab;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.jakewharton.android.mapsforge_fragment.GeoPoint;
import com.jakewharton.android.mapsforge_fragment.MapView;
import com.jakewharton.android.mapsforge_fragment.MapViewMode;

public class MapFragment extends Fragment {
    private static final String KEY_LATITUDE_E6 = "MapFragment:LatitudeE6";
    private static final String KEY_LONGITUDE_E6 = "MapFragment:LongitudeE6";
    private static final String KEY_ZOOM_LEVEL = "MapFragment:ZoomLevel";
    private static final String KEY_MAP_FILE = Environment.getExternalStorageDirectory()+ "/great_britain.map";

    private final MapViewMode mMapViewMode;


    public MapFragment() {
        this(MapView.DEFAULT_MAP_VIEW_MODE);
    }

    public MapFragment(MapViewMode mapViewMode) {
        mMapViewMode = mapViewMode;
    }


    @Override
    public MapView getView() {
        return (MapView)super.getView();
    }

    @Override
    public MapView onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        MapView mapView = new MapView(getActivity(), mMapViewMode);
        if (savedInstanceState != null) 
        {
            final int latitude = savedInstanceState.getInt(KEY_LATITUDE_E6, Integer.MIN_VALUE);
            final int longitude = savedInstanceState.getInt(KEY_LONGITUDE_E6, Integer.MIN_VALUE);
            final byte zoom = savedInstanceState.getByte(KEY_ZOOM_LEVEL, Byte.MIN_VALUE);
            final String mapFile = savedInstanceState.getString(KEY_MAP_FILE);

            if ((mapFile != null) &amp;&amp; !mapView.getMapViewMode().requiresInternetConnection()) {
                mapView.setMapFileFromParcel(mapFile);
            }

            if ((latitude != Integer.MIN_VALUE) &amp;&amp; (longitude != Integer.MIN_VALUE) &amp;&amp; (zoom != Byte.MIN_VALUE)) {
                mapView.setCenterAndZoom(new GeoPoint(latitude, longitude), zoom);
            }
        }

        return mapView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        MapView mapView = getView();
        if (mapView != null) {
            mapView.destroy();
            mapView = null;
        }
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        MapView mapView = getView();
        if (mapView.hasValidCenter()) {
            if (!mapView.getMapViewMode().requiresInternetConnection() &amp;&amp; (mapView.getMapFile() != null)) {
                outState.putString(KEY_MAP_FILE, mapView.getMapFile());
            }

            GeoPoint center = mapView.getMapCenter();
            outState.putInt(KEY_LATITUDE_E6, center.getLatitudeE6());
            outState.putInt(KEY_LONGITUDE_E6, center.getLongitudeE6());
            outState.putByte(KEY_ZOOM_LEVEL, mapView.getZoomLevel());
        }
    }

}
</code></pre>

<p><strong>Update ::</strong></p>

<pre><code>package in.wptrafficanalyzer.actionbarsherlocknavtab;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.jakewharton.android.mapsforge_fragment.GeoPoint;
import com.jakewharton.android.mapsforge_fragment.MapView;
import com.jakewharton.android.mapsforge_fragment.MapViewMode;

public class MapFragment extends Fragment {
    private static final String KEY_LATITUDE_E6 = "MapFragment:LatitudeE6";
    private static final String KEY_LONGITUDE_E6 = "MapFragment:LongitudeE6";
    private static final String KEY_ZOOM_LEVEL = "MapFragment:ZoomLevel";
    private static final String KEY_MAP_FILE = Environment.getExternalStorageDirectory()+ "/great_britain.map";

    private final MapViewMode mMapViewMode;


    public MapFragment() {
        this(MapView.DEFAULT_MAP_VIEW_MODE);
    }

    public MapFragment(MapViewMode mapViewMode) {
        mMapViewMode = mapViewMode;
    }

    @Override
    public MapView getView() {
        NoSaveStateFrameLayout wrapper = (NoSaveStateFrameLayout)super.getView();
        return (MapView)((wrapper != null) ? wrapper.getChildAt(0) : null);
    }

    @Override
    public MapView onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        MapView mapView = new MapView(getActivity(), mMapViewMode);
        if (savedInstanceState != null) {
            final int latitude = savedInstanceState.getInt(KEY_LATITUDE_E6, Integer.MIN_VALUE);
            final int longitude = savedInstanceState.getInt(KEY_LONGITUDE_E6, Integer.MIN_VALUE);
            final byte zoom = savedInstanceState.getByte(KEY_ZOOM_LEVEL, Byte.MIN_VALUE);
            final String mapFile = savedInstanceState.getString(KEY_MAP_FILE);

            if ((mapFile != null) &amp;&amp; !mapView.getMapViewMode().requiresInternetConnection()) {
                mapView.setMapFileFromParcel(mapFile);
            }

            if ((latitude != Integer.MIN_VALUE) &amp;&amp; (longitude != Integer.MIN_VALUE) &amp;&amp; (zoom != Byte.MIN_VALUE)) {
                mapView.setCenterAndZoom(new GeoPoint(latitude, longitude), zoom);
            }
        }

        return mapView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        MapView mapView = getView();
        if (mapView != null) {
            mapView.destroy();
            mapView = null;
        }
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        MapView mapView = getView();
        if (mapView.hasValidCenter()) {
            if (!mapView.getMapViewMode().requiresInternetConnection() &amp;&amp; (mapView.getMapFile() != null)) {
                outState.putString(KEY_MAP_FILE, mapView.getMapFile());
            }

            GeoPoint center = mapView.getMapCenter();
            outState.putInt(KEY_LATITUDE_E6, center.getLatitudeE6());
            outState.putInt(KEY_LONGITUDE_E6, center.getLongitudeE6());
            outState.putByte(KEY_ZOOM_LEVEL, mapView.getZoomLevel());
        }
    }
}
</code></pre>
