简体   繁体   English

活动结束后如何不停止asynctask

[英]How not to stop asynctask when the activity finish

I have an activity with an async task to send a file to a web service, if I am in the activity, I send the file, in the middle of the process I go to back to the activity, the async task finish. 我有一个带有异步任务的活动,该任务将文件发送到Web服务,如果我处于活动状态,则发送文件,然后在返回活动的过程中,异步任务完成。 How can I make this not happen? 我该如何避免这种情况发生?

您可以使用progressDialog并将Cancelable设置为false来防止这种情况。

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

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