You should not be using singleTask to "fix" problems like this, as the
launch mode is intended to control the flow through the activity, not to let
you avoid dealing with activity lifecycle.  Please read the app model doc to
understand what happens when you use this.  It can cause very undesirable
effects if not used appropriately.

Pressing back and then returning to the activity -should- result in a new
instance of the activity being started, since the default behavior of back
is to close the current one.  You just should deal with this, and point
everything to the new activity.  (And really, you shouldn't generally leave
stuff running in your process associated with an activity that has been
finished.  The user pressed back, your activity is finished, and its work
should stop.)  If you have some long-running operation that needs to
continue outside of the regular activity lifecycle, a Service is a common
approach to take.

On Tue, Dec 30, 2008 at 1:26 PM, Christine <[email protected]>wrote:

>
> If what Sundog says is true, i.d. that you have two instances of an
> activity where there should be only one, you can spedify "singletask"
> in the manifest file. that solved a similar problem I had. Make sure
> you spedify "singletask" just fot that one activity.
>
>
>
> On Dec 30, 8:29 pm, Sundog <[email protected]> wrote:
> > Only thing I can think of is that maybe somehow you've created a
> > second TextView object upon resume and the messages are going to the
> > wrong one. I've done something similar...
> >
> > On Dec 30, 9:35 am, Dan <[email protected]> wrote:
> >
> > > I'll just say upfront that I apologize if this is a duplicate post. I
> > > originally posted this message in the Beginners group but now I can't
> > > find it anywhere so I thought I would post it here this time.
> >
> > > Anyway, I have an activity where I'm just listening for udp messages
> > > in a background thread and then just posting those messages in a
> > > TextView widget. When I originally go into the activity everything
> > > works great. The messages are obtained from the background thread and
> > > posted to the UI thread through a message handler. The string is then
> > > written to the textview control via a call to the append() method.
> >
> > > The issue I'm having is if I exit the activity (via the back button on
> > > the G1) and then reenter the activity. Everything works great except
> > > the writing to the textview control. I can see the message being
> > > received in the background thread and being handed off to the message
> > > handler just fine. But when I make the call to append() nothing ever
> > > gets written out to the textview control.
> >
> > > Has anyone seen this behavior before? Is there something I"m missing
> > > with the textview control? Any help is greatly appreciated.
> >
> > > Dan
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to