Skip to content Skip to sidebar Skip to footer

Dismiss Progress Dialog In Another Activity ... Android

I have Tow Activities: FirstPageActivity SecondPageActivity The App call the SecondPageActivity by the FirstPageActivity... and the App send HttpRequest In the SecondPageActivity

Solution 1:

I want to show Progress Dialog in the FirstPageActivity and After the SecondPageActivity Finish downloading the data, it Dismiss the Progress and then Appear.Is that Possible ?

No.

You can't handle one Activity's UI functionality or any functionality from another `Activity.

If you start a ProggressDailog in FirstPageActivity then you must be dismiss it in onPause() before proceeding to other Activity as you said SecondPageActivity.

You can start a new ProggressDailog in SecondPageActivity from onCreate() or onResume() method.

Update: From the document of ProggressDailog you can see, to initialize a ProggressDialog its need to pass the current Activity context.

ProgressDialog(Context context)
ProgressDialog(Context context, int theme)

Solution 2:

and the App send HttpRequest In the SecondPageActivity.

As you say SecondPageActivity send HttpRequest , then best way is to show the ProgressDialog in SecondPageActivity.

In onCreate of SecondPageActivity show the ProgressDialog and dismiss it when HttpRequest complete

Post a Comment for "Dismiss Progress Dialog In Another Activity ... Android"