Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Cannon Game App > 7.4. Building the App’s GUI and Resource Files

7.4. Building the App’s GUI and Resource Files

In this section, you’ll create the app’s resource files and main.xml layout file.

7.4.1. Creating the Project

Begin by creating a new Android project named CannonGame. Specify the following values in the New Android Project dialog, then press Finish:

Build Target: Ensure that Android 2.3.3 is checked

Application name: Cannon Game

Package name: com.deitel.cannongame

Create Activity: CannonGame

Min SDK Version: 8.

7.4.2. AndroidManifest.xml

Figure 7.3 shows this app’s AndroidManifest.xml file. As in Section 6.6, we set the activity element’s android:screenOrientation attribute to "portrait" (line 9) so that the app always displays in portrait mode.


 1   <?xml version="1.0" encoding="utf-8"?>
 2   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 3      package="com.deitel.cannongame" android:versionCode="1"
 4      android:versionName="1.0">
 5      <application android:icon="@drawable/icon"
 6         android:label="@string/app_name" android:debuggable="true">
 7         <activity android:name=".CannonGame"
 8            android:label="@string/app_name"
 9            android:screenOrientation="portrait">
10            <intent-filter>
11               <action android:name="android.intent.action.MAIN" />
12               <category android:name="android.intent.category.LAUNCHER" />
13            </intent-filter>
14         </activity>
15      </application>
16      <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10"/>
17   </manifest>


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint