Code the Activity
This class is just like the one we have been coding for virtually the entire book. Take a look at the code and then add this class to your project.
import android.app.Activity; import android.graphics.Point; import android.os.Bundle; import android.view.Display; public class GameActivity extends Activity { GameEngine mGameEngine; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Display display = getWindowManager() .getDefaultDisplay(); Point size = new Point(); display.getSize(size); mGameEngine = new GameEngine(this, size); setContentView(mGameEngine); } @Override protected void onResume() { super.onResume(); mGameEngine.startThread(); } @Override protected void onPause() { super.onPause(); mGameEngine.stopThread(); } }
Everything is very familiar except you can see that I...