Tuesday, August 9, 2011

[android-developers] Re: Intents

Didn't see your previous post... FLAG_ACTIVITY_SINGLE_TOP causes a
call to onNewIntent, but FLAG_ACTIVITY_NEW_TASK starts a new task and
new activity. Is onNewIntent even being called? It shouldn't be since
FLAG_ACTIVITY_NEW_TASK means the activity can't be recycled, it must
be created in the current "new" task. You probably want
FLAG_ACTIVITY_CLEAR_TOP and FLAG_ACTIVITY_SINGLE_TOP...

-Jim

On Aug 9, 1:59 pm, Jim <secondphonea...@gmail.com> wrote:
> That's true. Do you do anything in onResume() to alter the data? And,
> this might sound silly, but are you sure a String was stored where
> getString is called? (For example, if you putExtra a bundle, then
> getExtra returns a Bundle, not a string...)
>
> Hope that helps.
>
> -Jim
>
> On Aug 9, 1:16 pm, kypriakos <demet...@ece.neu.edu> wrote:
>
>
>
>
>
>
>
> > Gotcha - but do you agree that the following should work and return
> > the Extras bundle?
>
> >     @Override
> >         protected void onNewIntent(Intent intent){
>
> >                 Bundle extras = intent.getExtras();
> >                 ...
>
> > Like Mark said, the intent var that is passed to the onNewIntent each
> > time I start a new
> > intent on a particular activity should hold a ref to that new intent
> > and I should be able
> > to access the data from it. No?
>
> > On Aug 9, 1:26 pm, Jim <secondphonea...@gmail.com> wrote:
>
> > > Since setIntent() stores a reference to the intent sent to
> > > onNewIntent(), you need to either capture the data there or copy the
> > > Intent to a local variable and reference it. Once onNewIntent()
> > > finishes, the Intent goes away and your reference is null.
>
> > > Try that...
>
> > > -Jim
>
> > > On Aug 9, 10:46 am, kypriakos <demet...@ece.neu.edu> wrote:
>
> > > > > Blech.
>
> > > > he he ;)
>
> > > > > Use the Intent supplied to onNewIntent(). The Intent returned by
> > > > > getIntent() will always be the original Intent used to create the
> > > > > activity.
>
> > > > But I am - and that's where the null exception occurs. Not sure if the
> > > > setIntent or  the super are needed. I will poke around a bit more to
> > > > see what is going on. But if the Intent supplied by the onNewIntent()
> > > > is what I need then that puts me on the right path.
>
> > > > Thanks again guys

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

No comments:

Post a Comment