crawlero
crawlero

Reputation: 45

How to avoid an activity to be paused when a transparent activity is created

I have one activity that keeps refreshing the elements on it based on the responses from our server, and i created another activity that overlays the 1st activity with some information i need to collect from the user if he wants, but when i pop up this 2nd activity which is transparent and shows what is in the background, the objects that were getting refreshed stopped moving because the activity went to pause mode.

Still i can see the content on the activity that is behind but nothing is moving anymore.

How can i get my 2nd activity working with the transparency and still be able to see the content of the background activity running?

Upvotes: 0

Views: 1016

Answers (2)

Anggrayudi H
Anggrayudi H

Reputation: 15165

You cannot. Android only allows one active activity at a time. So once an activity is in foreground, another activity will be placed in background and triggers onPause method. To make a transparent activity, you can make it as a dialog activity.

Upvotes: 0

Gabe Sechan
Gabe Sechan

Reputation: 93678

You don't. An activity is paused whenever it is no longer the foreground activity- whenever any activity is launched on top of it. The transparency doesn't matter. If you don't want to be paused, don't make the new functionality an activity- make it a dialog, fragment, or an overlay of some sort.

Upvotes: 1

Related Questions