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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.