Redirect user to different activities based on login logout stats or other intro activities on first run of the app. Launcher activity without UI helps achieve this with no UI glitches.
SET: android:theme="@android:style/Theme.NoDisplay"
In your manifest file
<activity
android:name=".LauncherActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Use Activity Like this
package com.semicolondev.app;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
public class LauncherActivity extends Activity {
SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
preferences = getSharedPreferences("MyApp", 0);
String firstRun = preferences.getString("first_run", "yes");
String isLogin = preferences.getString("login", "no");
if (firstRun.equals("no") && isLogin.equals("no")){
finish();
startActivity(new Intent(getApplicationContext(), LoginActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
} else if ( firstRun.equals("no") && isLogin.equals("yes")){
finish();
startActivity(new Intent(getApplicationContext(), MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
} else {
finish();
startActivity(new Intent(getApplicationContext(), IntroActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
}
//setContentView(R.layout.activity_main);
}
}
Play Casino Review: Risk-Free Bet No Deposit on Dream
ReplyDeleteWelcome Bonus Details. No Deposit Free Bets Available · Betting Terms · good retro jordans Wagering Wholesale jordan 11 retro Requirements jordan 18 retro clearance · Player Support · Minimum Deposit ford escape titanium – £/€ 5 · Player Air Jordan 12 retro