On showing dialog i get “Can not perform this action after onSaveInstanceState”

前端 未结 17 1089
甜味超标
甜味超标 2020-11-29 18:37

Some users are reporting, if they use the quick action in the notification bar, they are getting a force close.

I show a quick action in the notification who calls t

17条回答
  •  心在旅途
    2020-11-29 19:27

    Using the new lifecycle scopes of Activity-KTX its as simple as the following code sample:

    lifecycleScope.launchWhenResumed {
       showErrorDialog(...)
    }
    

    This method can directly be called after onStop() and will successfully show the dialog once onResume() has been called upon returning.

提交回复
热议问题