2

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.

2
  • use the intent defined in my answer
    – Jorgesys
    Feb 13, 2014 at 22:54
  • "I replaced WelcomeSplash with another one of my classes" if you use "Splash" you will have no problems cause its has an intent-filter "launcher", but thats not the correct way to use the intent.
    – Jorgesys
    Feb 13, 2014 at 23:00

3 Answers 3

3

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 :)

2
  • I think he tried with <activity android:name=".welcomeSplash" > too.
    – Jorgesys
    Feb 14, 2014 at 16:39
  • Sry Its <activity android:name=".WelcomeSplash" > as a activity name starts in caps.
    – Subhalaxmi
    Feb 15, 2014 at 7:38
1

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

3
  • I added copy and paste exactly what you posted but the app force closes when the WelcomeSplash class gets called. The logcat says there is no activty to handle intent (com.XXXX.WelcomeSplash) Feb 13, 2014 at 22:42
  • Could you post your startActivity() method call from your Splash class?
    – daentech
    Feb 13, 2014 at 22:43
  • added the code, just a note though that it was origionally set up to be used with the Dashboard class, and when I put the dashboard.this back it does not force close anymore. Feb 13, 2014 at 22:48
1

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".

7
  • it is still force closing with the same message that there is no activity to handle the intent Feb 13, 2014 at 22:59
  • I can not figure out what the problem is to save my life. Do I not need any intent filters in the manifest for anything? Feb 13, 2014 at 23:12
  • after adding the entries to the manifest like you posted, do they need intent filters or anything else? because the way you mentioned is not working. Feb 13, 2014 at 23:33
  • No intent filters are not required, just be sure that are really activities, "public class WelcomeSplash extends Activity", be patient :)
    – Jorgesys
    Feb 14, 2014 at 0:07
  • Sorry for being jumpy, I really do appreciate your help so far. I do have the WelcomeSplash extends Activity at the top. While playing around in the manifest I removed the intent filters from the dashboard.class which is what is autoloading where I want the WelcomeSplash to run. When I removed the intent filters there it also force closed. When I put the intent filters back and moved them under the WelcomeSplash it still force closed. When i put the intent filters back under the Dashboard class the app will run sucessfully Feb 14, 2014 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.