Android Game Programming For Dummies Cheat Sheet - dummies
Cheat Sheet

Android Game Programming For Dummies Cheat Sheet

From Android Game Programming For Dummies

By Derek James

Developing games for Android is a complex task. But it’s possible if you approach the project step by step. These guidelines will help you make short work of big projects.

Android Game Development Help

Developing an Android game is a complex process, but there’s plenty of experience to guide you. Online and personal resources can make the process a journey of discovery, not dead ends:

  • Stuck with a technical question about how to accomplish a particular task or deal with a bug? Try posting the question at or on the Android Developer Google Group.

  • Samples of games and other apps are included in the Android SDK in the directory where you installed the SDK (/android/samples/<sdk-version>).

  • Test on as many devices as you can! The emulator is a decent tool, but don’t rely on it to provide the same game experience as a hardware device.

  • Get feedback from friends, families, and other beta testers. They can be your most valuable resources in game development.

Android Game Design Preparation

Before you begin developing an Android game, it pays to be prepared. You need to answer the following questions before you begin programming your game:

  • Who is your target audience?

  • Which hardware/software versions are you targeting?

  • Do you plan to monetize your game? If so, how?

  • What genre is your game?

  • Who is your competition?

  • Is your game single or multiplayer? Is it social?

  • How will people control and interact with your game?

  • Are you targeting other cultures/languages?

  • Are you targeting players with special needs?

  • Where will you get the art and sound resources?

Common Android Game Development Tasks

In the process of developing Android games, you’ll perform a few common tasks over and over. If these tasks aren’t already automatic for you, keep them handy.

Fix an app in portrait or landscape (in manifest file):


Disable screen timeout:

public class MyActivity extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        MyView myView = new MyView(this);

Load an image:

private Bitmap myImage;
public myView(Context context) {

Draw an image:

protected void onDraw(Canvas canvas) {
   canvas.drawBitmap(myImage, 0, 0, null);

Load a sound:

Soundpool sounds = new SoundPool(5,AudioManager.STREAM_MUSIC, 0);
int mySound = sounds.load(myContext, R.raw.my_sound, 1);

Play a sound:

AudioManager am = (AudioManager)
float volume = (float) 
    audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);, volume, volume, 1, 0, 1);