Game Development Reference
In-Depth Information
Now you are ready to start using the device. Select Run ➤ Run from the main Eclipse menu.
A window should appear in which you can choose to run the program on an actual Android device or
an Android Virtual Device (see Figure
1-27
). Select the hardware device and click the OK button.
Figure 1-27.
Choose a device on which to run your program
The program running on the device should be the same as depicted in Figure
1-25
. Press the Back
key to exit the program.
The Main Source Code
When you create a new program within the Android development framework, what you are actually
doing in terms of coding is creating a new activity. What you need to do is derive a new class from
the existing
Activity
class that is part of the standard Android code base (see Listing 1-1).
Listing 1-1.
MainActivity.java
Source Code for “RobsHelloWorld” Example
package com.robsexample.robshelloworld;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity
{
@Override