简体   繁体   English

恢复活动中正在运行的异步任务

[英]Restore running Async Task in Activity

I'm looking for a complete example of an activity which uses async task and implements a way to refer to a running async task after the activity is paused (onPause). 我正在寻找一个使用异步任务的活动的完整示例,并实现了一种在活动暂停(onPause)后引用运行中的异步任务的方法。 I searched the web for an example which I could use but didn't find a complete one, only code fragments. 我在网上搜索了一个可以使用的示例,但没有找到完整的示例,只有代码片段。

I'm using async task to ping servers in my app, but a way to save a reference to running async tasks is missing so after onPause, the running tasks get lost. 我正在使用异步任务ping我的应用程序中的服务器,但是缺少保存对正在运行的异步任务的引用的方法,因此在onPause之后,正在运行的任务会丢失。

thanks in advance :-) 提前致谢 :-)

See this Commonsware blog post . 请参阅此Commonsware博客文章 He has an example of an asynctask working across orientation changes. 他有一个异步任务跨方向更改工作的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM