There are better ways of handling this. The purpose of an Intent is to
atomically request that an action is performed (and optionally
retrieve the result of that action), not to continue a discussion with
the activity throughout it's continued lifetime.

There are a number of ways to do what you want, if both the calling
and callee activities are in the same app (just a startActivity() type
call), you could use shared preferences:

http://www.androidcompetencycenter.com/2009/01/android-basics-managing-activity-states-part-ii/

If the activities are in different apps, you should use a content
provider to handle the IPC:

http://developer.android.com/intl/de/guide/topics/providers/content-providers.html

Either approach will allow you to share the state data between your activities.


On Fri, Mar 5, 2010 at 11:22 AM, draf...@gmail.com <draf...@gmail.com> wrote:
> I currently have an application that has code in it that starts an
> Activity but shortly afterwards it also sends an intent so the newly
> started activity knows what state to display in.
>
> So the activity starts...
>
> then code decides it should be in state one....
>
> button 1 and 2 are displayed.
>
> Or
>
> The activity starts...
>
> then code decides it should be in state one....
>
> button 3 and 4 are displayed.
>
> So it kind of works at the minute but sometimes my activity isn't
> fully started when the intent is fired so the intent fires before the
> receiver in the new activity is registered and the new activity stays
> in a blank state.
>
> Is there anyway to make sure my Activity is started and receiver
> registered before firing the intent?
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to