user user
user user

Reputation: 2172

android how to start the main activity when I am on another activity

I am on signin activity and if the user click a button I want to start the main activity. this is the mainfest for the main activity welcome

<activity
            android:name=".Welcome"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

I tried like this

Intent welcomeIntent =new Intent("android.intent.action.MAIN");
        startActivity(welcomeIntent);

but i got a screen saying complete acting using with many choese , what is the solution pelase?

Upvotes: 1

Views: 85

Answers (1)

dymmeh
dymmeh

Reputation: 22306

Change your intent to directly launch your class

Intent welcomeIntent = new Intent(context, Welcome.class);
startActivity(welcomeIntent);

If you're in an activity replace context with this

Upvotes: 4

Related Questions