No, if the user selects your game from home while it is already running, it
will be brought to the foreground.

On Thu, Jul 16, 2009 at 7:31 PM, rukiman <[email protected]> wrote:

>
> Thanks Dianne. I have changed the game so much regarding the
> singleTask, singleInstance and confused myself in the process in terms
> of the behaviour I was seeing :) So I'm trying to figure out what
> meets my game's requirements before making any more confusing changes
> lol.
>
> If I don't make my splashscreen, menu and game activities to be
> singleTask, doesn't that mean that when a user is playing my game,
> presses the HOME key and clicks on the game icon, another new instance
> of my game is created? I want to enforce only one instance of the
> game, hence my reasoning for singleTask.
>
> I had a look at the lunarlander, and I am assuming it does not enforce
> a single instance as I cannot see any activity flags specified.
>
>
> On Jul 17, 12:24 pm, Dianne Hackborn <[email protected]> wrote:
> > Definitely don't make them singleTask.  Is there some behavior you are
> > seeing when using the default launch mode that you are trying to solve?
>  It
> > should work fine from what you describe.
> >
> > As far as what you can assume...  receiving onCreate() just means that
> the
> > system need to make a new instance.  This may be because the user pressed
> > back to close your activity and is now restarting it, or they left it by
> > pressing home (but leaving it still running) and the system had to kill
> it
> > for its memory and the user has now returned to it.  You can distinguish
> > these with the savedState -- it will be non-null in the latter case.
> >
> > As far as knowing whether your bitmaps are loaded -- that should probably
> be
> > done by just checking whether the variable(s) holding those bitmaps are
> > set.  I'd guess that you want to put these into a static global, so they
> > will only get reset when your process is killed and restarted.
> >
> >
> >
> > On Thu, Jul 16, 2009 at 7:06 PM, rukiman <[email protected]>
> wrote:
> >
> > > I am completely confused with this. I am writing a game and there
> > > should only be on instance of this game.
> >
> > > So far I have:
> > > Splash screen activity
> > > Menu activity
> > > Game activity
> >
> > > The Game activity is the default activity and it will fire off an
> > > intent with result to start the splash screen activity on the
> > > onCreate.
> >
> > > The splash screen activity loads all the bitmaps required for the
> > > game, once it is finished it will return the result to the game
> > > activity which then knows all the bitmaps are finished.
> >
> > > The Game activity then will fire off an intent to show the Menu
> > > acitivty.
> >
> > > Now since I only ever want one instance of my game. Should I make the
> > > Splash screen, Menu and Game activity all singleTask?
> >
> > > If my Game activity is singleTask and I start a Menu activity that is
> > > singleTask, is the Menu on a seperate task to the Game activity? How
> > > can i make them all in one task?
> >
> > > I guess in my case whenever the Game activity gets an oncreate I can
> > > safely assume I have to start from scratch i.e display splash screen
> > > etc as I cannot assume the bitmaps are in memory.
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
> >
> > 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
[email protected]

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to