Я пытаюсь реализовать Здесь Карты в Фрагмент , но это не работает.Я получил много сбоев
Журналы сбоев:
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:379)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
Caused by: com.here.android.mpa.common.UnintializedMapEngineException: Cannot create HERE SDK object before MapEngine is initialized. See MapEngine.init()
at com.nokia.maps.BaseNativeObject.u(BaseNativeObject.java:39)
at com.nokia.maps.BaseNativeObject.<init>(BaseNativeObject.java:26)
at com.nokia.maps.MapImpl.<init>(MapImpl.java:424)
at com.here.android.mpa.mapping.Map.<init>(Map.java:710)
at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onEngineInitializationCompleted(BusTripFragment.java:179)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:279)
at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onCreate(BusTripFragment.java:136)
at android.support.v4.app.Fragment.performCreate(Fragment.java:2331)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1386)
at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1188)
at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1071)
at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:115)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2380)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2245)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3248)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3200)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
at ie.globetech.transitconnex.activity.bustrips.BusTripMainActivity.onStart(BusTripMainActivity.java:125)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
at android.app.Activity.performStart(Activity.java:6965)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2934)
... 9 more
Макет фрагмента:
<com.here.android.mpa.mapping.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
Класс фрагмента:
public class BusTripFragment extends Fragment{
private Activity mActivity;
private Map map = null;
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ApplicationContext appContext = new ApplicationContext(mActivity.getApplicationContext());
MapEngine.getInstance().init(appContext, this);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mActivity = (Activity) activity;
//mCallbacks = (MyNavigationDrawerCallbacks) activity;
} catch (ClassCastException e) {}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.trip_fragment, container, false);
mapView = (MapView) view.findViewById(R.id.map);
return view;
}
@Override
public void onEngineInitializationCompleted(Error error) {
// retrieve a reference of the map from the map fragment
//map = mapFragment.getMap();
isMapEngineInitialized = true;
if (map == null) {
map = new Map();
}
mapView.setMap(map);
// Set the map center to the Vancouver region (no animation)
map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0), Map.Animation.NONE);
// Set the zoom level to the average between min and max
map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
}
}
Я использую ЗДЕСЬ SDK Версия: 3.7.0.118
Я хочу пройти под therads
- ЗДЕСЬ Карта/ MapView без использования MapFragment
Кто-нибудь знает, как работать с Here Maps MapView во фрагменте?