开发者

How to correctly pass Activity to AccountManager in background thread?

开发者 https://www.devze.com 2023-03-20 03:40 出处:网络
Question to ANDROID developers only: I\'m looking for help with understanding of AccountManager class (http://developer.android.com/reference/android/accounts/AccountManager.html).

Question to ANDROID developers only:

I'm looking for help with understanding of AccountManager class (http://developer.android.com/reference/android/accounts/AccountManager.html).

In docs there is a note: Requests which may block, including getResult(), must never be called on the application's main event thread. Some of these requests require Activity to start another intent if needed.

I guess in getResult() a new inte开发者_开发技巧nt could be started as sub-activity to the activity passed to the request, but this code is executed on background thread and activity passed to request could be already destroyed due to different reasons.

When I use getResult() on background thread, how can I be sure that Activity is not destroyed (e.g. due to screen rotation)?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号