I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always helps. I will basically have the following:

  • A surface view that draws bitmaps in a 2d scene and rearranges them according to what ever is happening on the screen.
  • A main UI interface that needs to be shown on top of the surface view at all times that has buttons like the attack, defend, hotkeys and so on.
  • A start menu as a seperate activity that the user can choose options like volume, orientation, graphics quality, save & exit and so on.

Also I want dialogs throughout the games that pop up when interacting with NPCs and these dialogs need to display pictures as well.

That pretty much encompasses the first version of the game. I will add complexity to it maybe later on down the road but for now I would just like a general plan of how to set all of this up in a functional way. Again code would be nice but I really just need an idea of how to efficiently do these things without wasting memory resources and utilizing the Android APIs capabilites with smart programming methods.


On my personal projects, usually any menu out of the actual game (like start menu, options etc...) are done using basic XML layout provided by the Android API.

For in game UI (including dialogs and popups), I mostly make it inside my canvas, which let me integrate it inside the game.

But I guess that uising a frame layout, you could use native buttons and interface element on top of your surface.

About the NPC dialogs, I know that Replica Island using an separate Activity to diplay a popup (you can check out their source code, it's made by an engineer from Google and it's open source)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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