Fofole
Fofole

Reputation: 3548

Dialog pauses calling activity?

With the risk of this beeing a stupid question:

Every time I create a dialog the activity that creates and owns the dialog gets paused-I say this because the animations from my activity stop running. Is there a way to create the dialog so that your animations will keep running although the focus will be set to the dialog? Thanks.

Upvotes: 6

Views: 4164

Answers (2)

Hernan Romero
Hernan Romero

Reputation: 113

I know that this is a really old question but I didn't find an answer anywhere. I solved it by calling the Dialog this way:

yourDialog.setOwnerActivity(this);
yourDialog.show();

You should pass the calling context as a parameter and that keeps the activity running on the dialog background.

Upvotes: 0

jeet
jeet

Reputation: 29199

Activity's lifecycle is such as that if activity loses focus, its onPause method gets called, if you dont want such, and still want to lose focus from the activity layout, have a relative layout both having width and height fill parent, in one have your activity layout, and of other layout's background transparent, add ProgressBar to second layout. set second layout's visibility gone initially. and set visible or gone when you want to display or dismiss dialog.

Upvotes: 1

Related Questions