Thank you, Dianne. I was thinking to things like adding/removing Views
to ViewGroups, etc. Two questions, then:
1.
In certain circumstances, I send a message via the UI Handler which
changes visibility of some of my Views. Some Views are set visible
("foreground", practically), others are set to View.GONE.
E.g. if the user turns off the screen (resulting in an onPause()) when
the message has already been sent, then the UI thread will handle the
message in the state of a turned-off screen (a paused activity).
Similarly, if the Home button is pressed, the activity gets an
onStop() too, and the message that manipulates the View visibility
might be handled when we are already in the home screen. I suppose
these are OK, as these are internal state changes in the View system,
and when the screen is on, they will be applied nicely. So I suppose
it would be unnecessary (and bad practice) to check whether we're
visible when a message is handled.
2. Someone on stackoverflow mentioned that using AlertDialog when your
Activity is not in foreground/visible will cause a BadTokenException,
because "AlertDialog creates a new window". But it didn't look to be a
too reliable comment, so this point might be irrelevant (if it's not,
please clarify it if possible).
On máj. 12, 22:20, Dianne Hackborn <
hack...@android.com> wrote:
> Is there something specific you are wondering about? There aren't a
> general sweeping set of things you can't arbitrarily do in different states.
>
> On Sat, May 12, 2012 at 11:17 AM, Tamás Kovács
> <
falcon.firebre...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Hello,
>
> > I know the Activity lifecycle and related concepts & definitions, but
> > I haven't found a clear answer to the following:
>
> > What type of operations are allowed in/after onPause,onStop? Since
> > onPause means we aren't foreground, and onStop means we aren't visible
> > at all, some UI manipulating operations might not be allowed.
>
> > Are there any operations (methods) that assume a visible Activity?
>
> > Motivation of my question: obviously, some messages sent to my UI
> > Handler will change on the UI, but these messages might arrive e.g.
> > after onPause() if the user is quickly turning on and off the device
> > screen, for example.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to
android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
android-platfo...@googlegroups.com.
> > For more options, visit this group at
> >
http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
>
hack...@android.com