5
我知道這裏有一些針對Mapsforge的片段的補丁:https://code.google.com/p/mapsforge/issues/detail?id=177。但是我不確定如何使用它。Mapsforge的片段支持
這是我到目前爲止已經實現:
public class TOfflineMapViewFragment extends SherlockFragment{
MapView myOpenMapView;
//other codes here...
public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle savedInstanceState) {
view = inflator.inflate(R.layout.offline_map_activity, container, false);
myOpenMapView = (MapView) view.findViewById(R.id.openmapview);
myOpenMapView.setMapFile(new File(Environment.getExternalStorageDirectory().toString() +
"/offlineMap/singapore.map");
return view;
}
}
這是我的xml文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<org.mapsforge.android.maps.MapView
android:id="@+id/openmapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
我得到這個錯誤:
03-19 15:51:04.243: E/AndroidRuntime(10395): FATAL EXCEPTION: main
03-19 15:51:04.243: E/AndroidRuntime(10395): android.view.InflateException: Binary XML file line #6: Error inflating class org.mapsforge.android.maps.MapView
03-19 15:51:04.243: E/AndroidRuntime(10395): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
03-19 15:51:04.243: E/AndroidRuntime(10395): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-19 15:51:04.243: E/AndroidRuntime(10395): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
03-19 15:51:04.243: E/AndroidRuntime(10395): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-19 15:51:04.243: E/AndroidRuntime(10395): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-19 15:51:04.243: E/AndroidRuntime(10395): at com.fragments.TOfflineMapViewFragment.onCreateView(TOfflineMapViewFragment.java:76)
是什麼這個錯誤?