开发者

Implementing a background thread - Slow process

开发者 https://www.devze.com 2023-03-18 04:30 出处:网络
So I have a method in my android program that takes a long time to process since it has some implementation in fetching data from the internet.

So I have a method in my android program that takes a long time to process since it has some implementation in fetching data from the internet.

I wanted to put this process in the background and have it update the UI when it completes but not prevent the user from seeing the program.

The problem i开发者_Go百科s though I just have it all in one method (This function that takes a few seconds). I know it works properly and from what I've seen with ASyncTask I would need to split it up for it to utilize ASyncTask.

Is there anyway I can just do something so that this one in particular method can just be put on another thread? It seems extraneous to have to split up something that already works :-/

Edit: Solved, I ended up just using ASyncTask and taking the time to understand it. I only need to tinker two or three lines and it works perfectly now.


You can always just use a Thread and Handler combo

0

精彩评论

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