java.lang.RuntimeException: Unable to resume activity {com.ydatong.v2ex/com.ydatong.v2ex.Main.MainTabBarActivity}: kotlin.UninitializedPropertyAccessException: lateinit property tabItem has not been initialized
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5181)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5214)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2572)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)这个属性,在后台回到前台的时候,还有一个问题切 tab 没有自动加载数据
at android.app.ActivityThread.main(ActivityThread.java:8677)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$
MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property tabItem has not been initialized
at com.ydatong.v2ex.Business.Topic.Activity.TopicListFragment.getTabItem(TopicListFragment.kt:36)
at com.ydatong.v2ex.Business.Topic.Activity.TopicListFragment.onResume(TopicListFragment.kt:84)
at androidx.fragment.app.Fragment.performResume(Fragment.java:3039)
at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
at androidx.fragment.app.Fragment.performResume(Fragment.java:3048)
at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:273)
at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:245)
at android.app.Activity.performResume(Activity.java:9090)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5171)
... 13 more
发现个 bug 记得初始化