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.
Asked
Active
Viewed 1,532 times
0

Harsha M V
- 54,075
- 125
- 354
- 529

suresh cheemalamudi
- 6,190
- 11
- 49
- 67
-
1Yes you can do that with Progressbar widget. And thread in your class. – MysticMagicϡ Nov 14 '12 at 08:08
-
can u show me some sample code.? – suresh cheemalamudi Nov 14 '12 at 08:12
-
Google helps a looooottttttt. hundreds of tutorials. Search "ProgressDialog" for instance. – Vincent Mimoun-Prat Nov 14 '12 at 08:14
-
Refer to some examples that are available on net easily. http://www.mkyong.com/android/android-progress-bar-example/, http://stackoverflow.com/questions/9043683/how-to-show-progress-bar-status-by-percentage, http://androidsamplecodes4u.blogspot.in/2012/05/android-progress-bar-with-primary-and.html – MysticMagicϡ Nov 14 '12 at 08:14
2 Answers
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