Intelwalk
Intelwalk

Reputation: 671

android projects pulling from each other in eclipse

I have two projects with similar starting splash and menu activities, but the package name is different. When I run my latest project it is pulling the other menu activity from the other project. Is this something i've screwed up in naming something? I checked my Manifest and everything appears to be correct. Anyone had this happen before? Manifest:

    <activity
                android:name=".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=".Menu"
                android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MENU" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

Activity:

package com.****.tools;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class Splash extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        Thread timer = new Thread(){
            public void run(){
                try{
                    sleep(3000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }finally{
                    Intent openMainMenu = new Intent("com.*****.MENU");
                    startActivity(openMainMenu);
                }
            }
        };
        timer.start();
    }
}


package com.****.tools

import android.app.Activity;
import android.os.Bundle;

public class Menu extends Activity{
    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu);
    }

}

Upvotes: 0

Views: 78

Answers (1)

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

You are opening the actitty using action but not defined in new manifest so it is taking from the old

Intent openMainMenu = new Intent("com.*****.MENU");//<---------
                    startActivity(openMainMenu);

Note the new Action name should be differ from old one other wise it will so a select dialog having both activity in that.

        <activity 
            android:name=".Menu"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.*****.MENU_NEW" />
                <action android:name="android.intent.action.MENU" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    Intent openMainMenu = new Intent("com.*****.MENU_NEW");//<---------
                    startActivity(openMainMenu);

Upvotes: 1

Related Questions