How to know an Android task's visibility change? -
I have 2 activities that are using the same Android work - that is, they will use the same back stack.
> Call the first activity back in the heap, and call the second activity in the Case 1: Case 2: Question: How do I differentiate between those 2 cases? What is one way to know that the infection is in the Actually, I have to get an event when the Android task scene or invisible. If I understand you correctly, then your activity First of all, it is not a good idea to do something about an activity when it is no longer visible. As we see in Android Lifecycle, it can be stopped: I will keep your background code in a service whenever the activity becomes Case 1: If you do this, then it happens: Activity Now the services know that it is still the same activity and acts accordingly. Case 2: Activity B back stack.
A indicates that it goes in the background when
A was in the foreground and then < Code> B comes in foreground (for any reason) because it has received an external motive).
A goes into the background when
A was in the foreground but another application started in the foreground it was done.
A foreground - & gt; In the background does A keep the current work displayed on the screen?
a If the activity
b does not activate after
A .
A or
b or starts again, then this service is notified < / P>
A goes into the background And Your Save In On-Pause Handler Sends a message to A. Service starts its timeout timer activity starts
b and sends a message to it. Resume handler service.
A goes into the background and sends the service its timeout timer starts This timeout (I think 200 mms And now your service knows that the work is no longer active and works accordingly.
Comments
Post a Comment