singletask activity for games

by rukiman » Fri, 17 Jul 2009 10:06:21 GMT


Sponsored Links
 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.



--~--~---------~--~----~------------~-------~--~----~



singletask activity for games

by Dianne Hackborn » Fri, 17 Jul 2009 10:24:57 GMT


 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.






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

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


singletask activity for games

by rukiman » Fri, 17 Jul 2009 10:31:36 GMT


 hanks 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:24pm, Dianne Hackborn <hack...@android.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



singletask activity for games

by Dianne Hackborn » Fri, 17 Jul 2009 10:43:20 GMT


 o, 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 <ruksh...@optushome.com.au> wrote:



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

--~--~---------~--~----~------------~-------~--~----~



singletask activity for games

by rukiman » Fri, 17 Jul 2009 11:53:18 GMT


 h I see. Thanks, I understand now.

On Jul 17, 12:42pm, Dianne Hackborn <hack...@android.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to find Key Performance parameters of an Android application

Hi Folks,

I am looking to find out the aunch latencyof an application by writing
an Android Java Application. For instance, when we launch a Browser, I want
to know how long it takes to the application to come to the ui and ready to
take an URL. The Logcat message prints the required information. But I am
looking to get this information programmatically.
01-06 22:11:24.059: INFO/ActivityManager(922): Displayed activity
com.android.browser/.BrowserActivity: 1678 ms

Also, is there a way to find the current LINUX and JAVA memory usage, CPU
usage of an application/task from Java layer?

I appreciate if you can provide some pointer on the same.

FYI, currently I am not looking to use db shell topor db shell
cat/proc/meminfocommands. I want the same information on the embedded
side, if possible from Java layer, at real time.

Regards,
-Arun

-- 

2. Android 2.0 Installation

Hi

I am trying to install the android 2.0. when i start the setup then it start
fatching...

i am using windows OS .. but when fetch it gives this error

Failed to fetch URL
http://dl-ssl.google.com/android/repository/repository.xml, reason:
dl-ssl.google.com

tell me how i resolved it... Please

-- 
Ali Murtaza

BCSF06M021
Research Assistant
Data Virtulization Ware House
PUCIT, Lahore, Pakistan
ali.murt...@pucit.edu.pk

-- 

3. Question regarding Dev Phone 2

4. media player....

5. Push technique in android

6. files and updating

7. PVPLayer:general question