How to change start Activity dynamically?

user2223286 picture user2223286 · Mar 29, 2013 · Viewed 9.4k times · Source

I am working on an android app. I want to change Start activity dynamically. i mean when user start app first time then start activity will different and when start second time start activity change.This will skip first two activity and move to third activity .how can i achieve this.

Answer

Mikalai Daronin picture Mikalai Daronin · Mar 29, 2013

You cannot change the first activity dynamically, but you can create a transparent activity like this:

<activity
    android:name=".ActivityLauncher"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

and select next activity in the onCreate method:

if ( logged() ) {
    intent = new Intent(this,MainActivity.class);
} else {
    intent = new Intent(this,SignInActivity.class);
}
startActivity(intent);
finish();