Reputation: 349
I have Tow Activities:
FirstPageActivity
SecondPageActivity
The App call the SecondPageActivity
by the FirstPageActivity
...
and the App send HttpRequest
In the SecondPageActivity
.
So 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 ?
Upvotes: 4
Views: 2691
Reputation: 9700
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)
Upvotes: 4
Reputation: 17085
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
Upvotes: 1