Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Currently my game has an Activity for the splash screen then it starts the main class activity then it starts a menu activity then from the menu there is an activity for each option (only two at the moment), Start and About.

Splash --> Main --> Menu --> (Start, About)

The start then sets a Content View for my game to draw to the screen.

What additional parts to a game should have or require an activity and what parts that I may or may not have don't need to be an Activity.


Activity:

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View)


Since we know what an Activity is, now I am just looking for places that it would be used in a game?

UPDATE

We have a great explanation of the game architecture in Android. This diagram is awesome!

enter image description here

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Use a single activity. Have a look at the basic game architecture here: http://www.thegamecoder.com/blog/?p=46

Implement your menus inside the MainView class in the link.

share|improve this answer
    
What other things could you want to do with a game in Android that would require more activities? Anything? –  KRB Sep 14 '11 at 18:07
    
I can't think of anything. I'd handle things like web requests with an asynchronous thread of some sort. –  ApoorvaJ Sep 15 '11 at 13:14

Have a look at Replica Island. It's written by one of the Google engineers. They use different activities for everything. But I think using one activity is way easier! Other games and some of the available game engines do it that way. The downside is that you have to implement behaviour like button presses etc. yourself.

share|improve this answer
    
I was wondering about this myself, they use multi-threading too right? one for game logic /sound and one for graphics if I remember correctly. –  bot_bot Feb 24 '12 at 14:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.