Starting the project

Create a new project and call it Scrolling Shooter. Use the same settings as we always have: empty Activity, no layout file, no backward compatibility, for phones and tablets. When prompted, name the Activity GameActivity.

Editing the manifest

Make the game full-screen and landscape orientation as we have done before by editing the AndroidManifest file. Add the code just after …:name=".GameActivity" but before the trailing >. Here is the new code highlighted in context with the existing code:

<activity android:name=".GameActivity"
   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
   android:screenOrientation="landscape"
>

The game is now locked to full screen and landscape orientation.

Code the GameActivity class

Here we will ...

Get Learning Java by Building Android Games - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.