0

I hav an application where I have an TabActivity and which have 2tabs(each tab as an activity) First tab(an activity) loads data from internet. So I want there a progressdialog until the 1st tab(an activity) loads data from internet.

ProgressDialog.show(TabHostActivity.this, "Working..", "Downloading Data...",true);
pd.dismiss();

only this much code i have which not give satisfaction please anybody tell me what i write to show a progressdialog until it download the data. (means i hav to use thread). Please give me answer along with code Thank you

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
Jyosna
  • 4,436
  • 13
  • 60
  • 93

2 Answers2

1

In tabGroupActivity ,use progressDialog in the folllowing way( If your activity is the sub Activity of any tabhost):

ProgressDialog.show(getParent(), "Working..", "Downloading Data...",true);

try this, and one more thing implement ProgressDialog using threads: see this for help : How to get a progress bar on button click?

Hope this will give you some idea on the topic.

Community
  • 1
  • 1
Dinesh Sharma
  • 11,533
  • 7
  • 42
  • 60
0

You should implement AsyncTask inside the First Tab activity, Asynctask is known as PainLess Threading.

Just go through the above 2 links and then do as follows:

  1. call dialog.show() method inside the doInBackground() method.
  2. call dialog.dismiss() method inside the onPostExecute() method.
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295