使用MapView时HoloEverywhere中的ClassNotFoundException

时间:2013-01-31 17:51:58

标签: android google-maps android-fragments android-holo-everywhere

我想将一个地图作为标题添加到ListFragment中。除非设备方向发生变化,否则一切似乎都能正常工作。

ListFragment:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
        return null;
    }

    mHeader = inflater.inflate(R.layout.map_header, null);      
    mMapView = (MapView) mHeader.findViewById(R.id.map);

    if (mMap == null) {
        mMap = mMapView.getMap();
        if (mMap != null) {
            mMap.setMyLocationEnabled(true);
        }      
    }

    return (LinearLayout) inflater.inflate(R.layout.my_fragment, container, false);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {              
    super.onActivityCreated(savedInstanceState);
    mMapView.onCreate(savedInstanceState);

    mListView = getListView();
    mListView.addHeaderView(mHeader);                       

    String[] array = new String[] {"Android", "Android"};

    setListAdapter(new ArrayAdapter<String>(getActivity(), R.layout.list_item, R.id.text1, array));
}

错误:

Class not found when unmarshalling: org.holoeverywhere.widget.ListView$SavedState, e: java.lang.ClassNotFoundException: org.holoeverywhere.widget.ListView$SavedState
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.i906.mpt/com.i906.mpt.Main}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: org.holoeverywhere.widget.ListView$SavedState

如果我更改为mMapView.onCreate(null);,则不会出现此问题,但每次方向更改时地图都会重新加载。任何想法如何解决这个问题?

感谢。

0 个答案:

没有答案