Again, driving your UI based on whether some other part of it is stopped is
probably NOT the right way to go about it.

In the example here, it is completely irrelevant.  Your problem is that you
have two activities with the same task affinity being launched as top-level
items.  Please read the docs on tasks and activities:

http://developer.android.com/guide/topics/fundamentals.html#acttask

For the specific case of an activity being launched from receiving an SMS,
you probably want to give that an empty task affinity so that it is not
considered part of your main application flow.  You can look at many of the
standard applications to see approaches to handling entry to them from
multiple places -- for example Calendar allowing you to see upcoming events
from the status bar, or music with its now playing screen you can get to
from the status bar.


On Tue, Jun 30, 2009 at 11:48 AM, Thomas <perd...@gmail.com> wrote:

>
> Hi,
>
> i was testing sms and I found another situation where I have the same
> problem, may be in this situation is easier to explain.
>
> Scenario:
> - Receive a SMS class Zero in the simulator. The activity
> ClassZeroActivity will be launched.
> - User clicks in home. Home screen is shown
> - User enters in "Messaging".
> - Messaging is not shown, ClassZero Activity is shown.
>
> If I would like to create another application, and the behaviour is
> "if there is a ClassZeroActivity stopped. Show this activity and not
> run me"
>
> Is it possible?
>
> Thanks again.
>
> Thomas
>
> On 6/29/09, Dianne Hackborn <hack...@android.com> wrote:
> > I am not talking about changing your own app, I am just suggesting how I
> > think you should go about doing what I -think- you were asking for.  I
> can't
> > see it being more than a day to use the approach I suggested (but this
> > information in shared preferences, and check it where you are wanting to
> > decide whether to show your dialog); it certainly isn't going to require
> > reworking your entire app.  Unless I am still not understanding what you
> are
> > asking.
> >
> > Anyway, that is my suggestion.
> >
> >
> > On Mon, Jun 29, 2009 at 10:30 AM, Thomas <perd...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I have some problems to change the approach now, the project is an
> > > advanced stage. Is it possible to solve this problem working with the
> > > UI state?
> > >
> > > thanks
> > >
> > >
> > >
> > >
> > > Thomas
> > >
> > > On 6/26/09, Dianne Hackborn <hack...@android.com> wrote:
> > > > It doesn't sounds to me like you should be driving this through UI
> state
> > at
> > > > all.  If you have remembered activities to show to the user, why not
> put
> > > > this information in some persistent place like SharedPreferences and
> > just
> > > > look there when your calendar starts up to see if there is stuff to
> show
> > > > before the main screen?
> > > >
> > > >
> > > > On Fri, Jun 26, 2009 at 12:13 PM, Thomas <perd...@gmail.com> wrote:
> > > > >
> > > > > Hi Dianne,
> > > > >
> > > > > Sorry, I'm beginner here. I'll give you more details, may be it'll
> be
> > > > > clear. Thanks
> > > > >
> > > > > I'm doing an agenda and I have a calendar implemented. There is an
> > > > > Activity to show the alerts of the agenda, it's a really simple
> > > > > activity which shows an alertDialog. I called this activity as
> > > > > RememberActivity
> > > > >
> > > > > Agenda Manifest:
> > > > > <application android:name="Agenda"
> > > > >                  android:label="@string/app_name">
> > > > >
> > > > > ...
> > > > > <activity android:name=".RememberActivity"
> > > > >
> > > > android:label="@string/class_remember_activity"
> > > > >
> > android:theme="@android:style/Theme.Dialog"
> > > > >            android:allowTaskReparenting="true"
> > > > >            android:taskAffinity="CalendarActivity"
> > > > >            android:excludeFromRecents="true">
> > > > >        </activity>
> > > > > ...
> > > > >
> > > > > User opens the agenda, and sees the Remembers Alert, the activities
> > > > > are shown. And so, he clicks on the "house button" and the alert
> > > > > enters in the "onStop" state by the Activity diagram.
> > > > >
> > > > > Now, user opens the Calendar (another application), but I'd like to
> > > > > have an interaction between these two applications. If there is
> some
> > > > > "RememberAlerts" of Agenda is stop state, the calendar shows these
> > > > > alerts before show its first screen.
> > > > > Because user needs to confirm he knows his tasks today, before do
> > anything
> > > > else.
> > > > >
> > > > > How can I do this stuff: Calendar needs to detect which there are
> > > > > RememberActivities hidden and so, Calendar "shows" these activities
> > > > > again and these activities become visible. If there is no Remember
> > > > > activities hidden, Calendar shows the main Screen (a Calendar of
> the
> > > > > the week).
> > > > >
> > > > > Thank you
> > > > >
> > > > > Thomas
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On 6/26/09, Dianne Hackborn <hack...@android.com> wrote:
> > > > > > Your question is vague enough that it is really hard to answer.
>  For
> > > > > > example, what do you mean by "stopped"?  What do you mean by
> > "launching
> > > > A"
> > > > > > (is it going on top of B?)?
> > > > > >
> > > > > > It is very useful if questions are posted as solutions to be
> solved
> > (I
> > > > want
> > > > > > to implement navigation through my app that looks like this,
> this,
> > and
> > > > that)
> > > > > > vs. isolated tasks (I want to tell B that A is stopped), since
> the
> > > > specific
> > > > > > task being attempted may already be done the wrong road.
> > > > > >
> > > > > > And please give enough detail for people to actually answer:
> > background
> > > > > > context for what you are doing, specifics of what your code is
> doing
> > > > (actual
> > > > > > code the best), full details of what you are observing that is
> wrong
> > and
> > > > > > what exactly you want to have happen instead.
> > > > > >
> > > > > >
> > > > > > On Fri, Jun 26, 2009 at 10:54 AM, Thomas <perd...@gmail.com>
> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > Can someone help me? I tried to use
> > > > > > >
> > > > > > >
> > > > > > >            android:allowTaskReparenting="true"
> > > > > > >
> > > > > >
> > android:taskAffinity="<PACKAGE_NAME.<ACTIVITY_NAME>"
> > > > > > >
> > > > > > > but it doesn't work.
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 6/25/09, Thomas <perd...@gmail.com> wrote:
> > > > > > > > Hi All,
> > > > > > > >
> > > > > > > > I've some problems with a task. There are an activity A
> stopped
> > and
> > > > I
> > > > > > > > start activity B in the same task. But if activity A is
> stopped,
> > > > > > > > activity B needs to discover that and launch activity A.
> > > > > > > >
> > > > > > > > Can someone help me?
> > > > > > > >
> > > > > > > > Thanks a lot.
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > >
> > > > > > Dianne Hackborn
> > > > > > Android framework engineer
> > > > > > hack...@android.com
> > > > > >
> > > > > > Note: please don't send private questions to me, as I don't have
> > time to
> > > > > > provide private support, and so won't reply to such e-mails.  All
> > such
> > > > > > questions should be posted on public forums, where I and others
> can
> > see
> > > > and
> > > > > > answer them.
> > > > > >
> > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > hack...@android.com
> > > >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see
> > and
> > > > answer them.
> > > >
> > > >
> > > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
> >
> >
> > >
> >
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  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 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