0

I have two activities on my android application & at the second one, it takes a while to load the data, I want to use the Progress bar to make the user feel there is an action happening, but I don't know how to set the code of the progress bar to run while a block of code executed.

Wooble
  • 87,717
  • 12
  • 108
  • 131
omnia Mm
  • 157
  • 5
  • 16

1 Answers1

1

It is generally a good idea to show ProgressDialog either before switching to the new activity, or just after new activity is shown, but data is still loading. You can check it here: http://developer.android.com/reference/android/app/ProgressDialog.html

AlexN
  • 2,544
  • 16
  • 13
  • I suggest to look at this topic - http://stackoverflow.com/questions/4538338/progressdialog-in-asynctask Besides of just showing ProgressDialog, it is a good idea to push loading from Main Thread to AsyncTask. Progress dialog will be shown before task will be completed and data loaded. – AlexN Sep 02 '12 at 11:22
  • Even better example - http://www.androidsnippets.com/grab-a-url-source-with-progressdialog-and-asynctask , that's just what you need. I don't like the codestyle, however, it is up to you :) – AlexN Sep 02 '12 at 11:26
  • thanks so much for your help ,, i read the artical and also the Application is Running now :) – omnia Mm Sep 02 '12 at 12:25