开发者

Android: Fetching an XML from a web service: Threads

开发者 https://www.devze.com 2023-02-08 01:28 出处:网络
Fetching an XML from a web service in background and displaying a progress bar in front while the xml is being downloaded in A开发者_StackOverflow社区ndroidHave a look at:

Fetching an XML from a web service in background and displaying a progress bar in front while the xml is being downloaded in A开发者_StackOverflow社区ndroid


Have a look at:

http://developer.android.com/resources/articles/painless-threading.html

and:

http://developer.android.com/reference/android/os/AsyncTask.html

For info on how to perform work in the background.

In short:

Subclass AsyncTask and override doInBackground(Params... params). In that method you should do the communication with the server and download the xml. You can call publishProgress(Progress... values) to have the UI thread run the method onProgressUpdate(Progress... values) in your AsyncTask. In that method you can define how to update the progressbar.

Cheers // Emil H

0

精彩评论

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