0

I am building an android app which will download some data and display it to the user. Now I need to show a circular progress bar until the data is downloaded. The download will begin on a button click. How can I achieve this? Sample code would be very helpful.

Harsha M V
  • 54,075
  • 125
  • 354
  • 529
suresh cheemalamudi
  • 6,190
  • 11
  • 49
  • 67

2 Answers2

4

You need to use an AsyncTask to execute your download and ProgressBar instance to show a circular progress.

There are many resources you can find which describe exactly how to use the combination to do what you want.

wojciii
  • 4,253
  • 1
  • 30
  • 39
3

Check Android AsyncTask class for what you want to achieve.

Basically you start showing a ProgressDialog in the onPreExecute of AsyncTask and dismiss it in onPostExecute when your background job is done.

Check these also.

android how to work with asynctasks progressdialog

http://twigstechtips.blogspot.com/2011/11/for-my-app-moustachify-everything-i-was.html

http://javatech.org/2011/02/discovering-android-opening-a-progress-dialog-with-asynctask/

Community
  • 1
  • 1
Serdar Dogruyol
  • 5,147
  • 3
  • 24
  • 32