Gabriel Matusevich
Gabriel Matusevich

Reputation: 3855

Eclipse: Android: Can't Chance Launcher Activity

I just started an Android Project and i made a Splash.png and Splash Activity for my App, with the Splash.xml, and the Splash.java with the onCreate Method and the setContentView, I also change the Intent in the manifest so the Splash would be the LAUNCHER. BUT the "MainActivity" is still default launcher, I cant change that.

And if I try to Clean up my proyect, Eclipse just wipes out everying I modified from the

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.learn.xandroix"
    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.learn.xandroix.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.learn.xandroix.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAINACTIVITY" />

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

    </application>

</manifest>

This is what the Eclipse Console is showing:

[2013-07-22 11:28:56 - XAndroiX] Installing XAndroiX.apk...
[2013-07-22 11:29:06 - XAndroiX] Success!
[2013-07-22 11:29:07 - XAndroiX] Starting activity com.learn.xandroix.MainActivity on device S5830f33ed19b
[2013-07-22 11:29:09 - XAndroiX] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.learn.xandroix/.MainActivity }

Upvotes: 0

Views: 684

Answers (4)

Fahim Faysal
Fahim Faysal

Reputation: 459

Try this way: Just care "action android:name" of 2nd activity. Enjoy :)

 <activity
        android:name="com.learn.xandroix.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.learn.xandroix.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.learn.xandroix.MAINACTIVITY" />

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

Upvotes: 0

Husnain Iqbal
Husnain Iqbal

Reputation: 466

Consider this;

<activity
            android:name="com.learn.xandroix.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.learn.xandroix.MainActivity"
            android:label="@string/app_name" >
        </activity>  

Upvotes: 0

UsmanAzam
UsmanAzam

Reputation: 549

Chnage this in you manifest.xml file

<activity
            android:name="com.learn.xandroix.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="MainActivity">
</activity>

Upvotes: 0

MSA
MSA

Reputation: 2482

Try this:

<?xml version="1.0" encoding="utf-8"?>

<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.learn.xandroix.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.learn.xandroix.MainActivity">
    </activity>        

</application>

Cheers

Upvotes: 2

Related Questions