Monday, May 3, 2010

[android-developers] Re: Which Intent Flags when setting PendingIntents in multiple app widget scenario?

FLAG_ACTIVITY_CLEAR_TOP also seems to work. In this case, onCreate is
called instead of onNewIntent.

Unlike FLAG_ACTIVITY_SINGLE_TOP, this helps in the situation where a
secondary activity is currently on top of the stack of that task. I
really need to make sure the main activity is displayed.

I suppose the drawback is that the activity will be reinitialised each
time.

On Apr 30, 4:20 pm, westmeadboy <westmead...@yahoo.co.uk> wrote:
> Excellent, that works. Thanks Mark.
>
> On Apr 30, 4:09 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
>
>
>
>
> > westmeadboy wrote:
> > > I have one WidgetProvider but expect the user to have multiple
> > > instances of the widget on the home screen.
>
> > > When the user clicks on the widget, an intent is fired to start an
> > > activity A passing a String extra (which is specific to that instance
> > > of the app widget).
>
> > > Everything works fine unless the activity is already running, in which
> > > case the activity is shown in its previous state (and so the intent
> > > extra data is ignored).
>
> > > I've tried using various Intent flags (like FLAG_ACTIVITY_NEW_TASK)
> > > but they don't seem to help.
>
> > Try FLAG_ACTIVITY_SINGLE_TOP and then override onNewIntent() in your
> > activity -- you should get the extra that way.
>
> >http://developer.android.com/reference/android/app/Activity.html#onNe...)
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Training in US: 14-18 June 2010:http://bignerdranch.com
>
> > --
> > 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 athttp://groups.google.com/group/android-developers?hl=en
>
> --
> 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 athttp://groups.google.com/group/android-developers?hl=en

--
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