Android ViewGroup crash: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference

前端 未结 10 2244
青春惊慌失措
青春惊慌失措 2020-12-08 00:15

We have found several cases for this kind of crashes reported by backend logging monitoring. It seems the crashes do not tie to particular UX failure. And from the reports,

10条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 00:32

    It's a threading issue. Could be that you're refreshing your ViewPager or some other adapter.

    Have been facing this issue on and off, and realised that if you place it in the UI Thread in your Activity, then it'll render just fine.

    activity?.runOnUiThread{
       // Add Your UI Updating Methods Here
    }
    

提交回复
热议问题