我正在尝试动态创建 MapView 并将其插入到正在运行的片段中。
我成功地将 MapView 插入其父布局(位于片段内),但地图未显示,并且我在谷歌地图库上得到内部异常。
我怀疑它与片段生命周期方法的转发有关。我已经转发了它们,但我怀疑只调用了 onResume,因为当我插入 mapView 时片段已经存在。
在提供的堆栈跟踪中,您可以看到内部 mapview 错误,并且它来自 onResume。
我应该手动调用 onCreate 和 onStart 吗?还是我做错了什么?
提前致谢!
06-11 21:11:29.799: W/System.err(7804): java.lang.NullPointerException
06-11 21:11:29.799: W/System.err(7804): at maps.aj.bi.b(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at bcz.onTransact(SourceFile:73)
06-11 21:11:29.799: W/System.err(7804): at android.os.Binder.transact(Binder.java:297)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.maps.internal.IMapViewDelegate$a$a.onResume(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.maps.MapView$a.onResume(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.internal.bb$6.b(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.internal.bb$1.a(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.maps.MapView$b.aP(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.maps.MapView$b.a(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.internal.bb.a(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.internal.bb.onResume(Unknown Source)
06-11 21:11:29.799: W/System.err(7804): at com.google.android.gms.maps.MapView.onResume(Unknown Source)
---------------------
06-11 21:11:29.799: W/System.err(7804): at com.regaliz.funq.story.FunqLayer_map.delegate_onResume(FunqLayer_map.java:66)
06-11 21:11:29.799: W/System.err(7804): at com.regaliz.funq.story.FunqSlide.onResume(FunqSlide.java:622)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.Fragment.performResume(Fragment.java:1503)
-------------------
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:807)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1112)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1461)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.view.ViewPager.populate(ViewPager.java:1064)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.view.ViewPager.populate(ViewPager.java:911)
06-11 21:11:29.799: W/System.err(7804): at android.support.v4.view.ViewPager$3.run(ViewPager.java:242)