Starting a service doesn't have anything to do with the activity stack.  It
is only needed if you actually must have a service running even after the
user leaves your app.  (And of course you must have a good plan for how you
will stop the service, so it doesn't get left running forever.)

On Tue, Apr 20, 2010 at 9:05 PM, Kenneth WON <kenneth...@gmail.com> wrote:

> Hi, Dianne Hackborn,
>
> Thank you!
> In the main activity, I will start a service, so I am calling
> startService() in onCreate().
> Is that not necessary?
>
>
>
> On Apr 21, 11:25 am, Dianne Hackborn <hack...@android.com> wrote:
> > Make sure you aren't calling startActivity() anywhere, such as in
> > onCreate().
> >
> > Look at the log (adb logcat) and event log (adb logcat -b events) to see
> > what the system is saying about launching and handling activities.
> >
> > Please don't use singleTask or singleInstance to fix such problems, they
> are
> > not needed and have other repercussions you probably don't want.
> >
> >
> >
> >
> >
> > On Tue, Apr 20, 2010 at 7:07 PM, Kenneth WON <kenneth...@gmail.com>
> wrote:
> > > Hi, thank you for your help!
> > > But I tried to add android:launchMode="singleTask" or
> > > android:launchMode="singleInstance" in the <activity> before, but it
> > > seems not work.
> > > The app still running twice or more at the same time by rotate screen
> > > or press return button, and launch the app.
> >
> > > On Apr 21, 4:38 am, "~ TreKing" <treking...@gmail.com> wrote:
> > > > On Tue, Apr 20, 2010 at 2:06 AM, Kenneth WON <kenneth...@gmail.com>
> > > wrote:
> > > > > But my expected result is just have one and only one app A launch.
> >
> > > >
> http://developer.android.com/intl/fr/guide/topics/manifest/activity-e...
> > > > <
> http://developer.android.com/intl/fr/guide/topics/manifest/activity-e..
> > > .>
> >
> > >
> ---------------------------------------------------------------------------
> > > ----------------------
> > > > TreKing - Chicago transit tracking app for Android-powered
> deviceshttp://
> > > sites.google.com/site/rezmobileapps/treking
> >
> > > > --
> > > > 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > 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<android-developers%2bunsubscr...@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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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