user3104719
user3104719

Reputation: 3465

Android Manifest implementation issues

I have never fully understood the manifest or how to add items to it. I have the manifest here that is working but I want to change something and I do not know what to change. Here is the manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.magicbuddy.gamble"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.magicbuddy.gamble.Splash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.welcomeSplash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.magicbuddy.gamble.Dashboard" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.Dashboard"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.MainActivity"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.Player"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.Menu"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="com.magicbuddy.gamble.Popup"
        android:label="@string/title_activity_popup" >
    </activity>
</application>

</manifest>

I have 2 new classes I have written. One is called Player.class and the other is called WelcomeSplash.class. Currently, as the manifest shows, that my splash screen loads and works and then the timer on the splash screen auto loads the next screen, the dashboard.class. Instead I want it to load one of my new classes, the WelcomeSplash.class. I do not know how to get my two new classes properly added into the manifest.

     startActivity(new Intent(Splash.this, welcomeSplash.class));

I replaced WelcomeSplash with another one of my classes, Dashboard, and it does not force close, it loads and runs just fine.

Upvotes: 2

Views: 335

Answers (3)

Subhalaxmi
Subhalaxmi

Reputation: 5707

Just as per your code, i make the changes and post the codehere. check and Use in Manifest..

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.magicbuddy.gamble"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.magicbuddy.gamble.Splash"
        android:label="@string/app_name" >

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER"            />
        </intent-filter>



    <activity
        android:name=".gamble.Dashboard" >
    </activity>
    <activity
        android:name=".MainActivity" >
    </activity>
    <activity
        android:name=".Player" >
    </activity>
    <activity
        android:name=".Menu" >
    </activity>
    <activity
        android:name=".Popup" >
    </activity>
 <activity android:name=".WelcomeSplash" >
        </activity>

</application>

</manifest>

No need to write <intent-filter> again. Thnk you :)

Upvotes: 3

Jorgesys
Jorgesys

Reputation: 126495

As dgg says just add the activities into your Manifest.xml

    <application>
...
...
...
        <activity
            android:name="com.magicbuddy.gamble.Player"
            android:label="Player" >
        </activity>
        <activity
            android:name="com.magicbuddy.gamble.welcomeSplash"
            android:label="WelcomeSplash" >
        </activity>
    </application>

if you have the exception "there is no activty to handle intent (com.XXXX.WelcomeSplash) here:

Intent openMainActivity = new Intent("com.magicbuddy.gamble.welcomeSplash");
startActivity(openMainActivity);

you must use:

Intent startMain = new Intent(this, welcomeSplash.class); 
startActivity(startMain);

read more about : Android Build an Intent

Here´s a question for you, whats the real name of your class, "WelcomeSplash" or "welcomeSplash", put the correct name on your Manifest.xml and in your Intent! :)

According to Java Standars, Class Names should be in CamelCase, so use "WelcomeSplash".

Upvotes: 1

daentech
daentech

Reputation: 1115

For every new activity you create you need to add the activity block to the manifest in the application section.

To add your new WelcomeSplash class, add the line:

<activity
            android:name="com.magicbuddy.gamble.WelcomeSplash"
            android:label="@string/app_name" >

between the tags

<application></application>

Once the class is in there your splash class should start the intent with WelcomeSplash.class

Upvotes: 1

Related Questions