First, do I need to create a new <activity> in my AndroidManifest.xml for each new java class?
Second, here is my AndoidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Alan.Gym_Rat"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".GymRatActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="mainmenu"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Does that look right? Because When I run the emulator, it shows two icons, so im not sure if I set things up right. The only addition I have made really is to get rid of the title bar.
Third and last, how do you specify the name of the app icon so its not the default name of the AVD?
Yes, you do have to create a new activity entry in the manifest file for each activity. The reason why you see two icons is because you marked them both with
android.intent.category.LAUNCHER. That should be reserved for things you want to show up in the launcher.Likewise, the
MAINaction should only be used for the main entry point of your app.By the way, what are the class names of your activities? I’ll assume it’s not
mainmenu, so you need to adjust the name to the actual class name. Also, you should prepend a dot (so if the class name is MainMenu, write.MainMenu).And the name should be what you specify in the label.