I have an activity main that is a login view, when app session starts , I load another activity named welcome user. if the user closed app, the next time that user opens the app, it starts the welcome activity directly without launching the main login activity configured in the file AndroidManifest.xml .
NOTE: when the app starts , I open the main activity in blank and later another activity, I am using this code :
// Activity Main
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
sessionPreferences = new SessionPreferences(getApplicationContext());
//verify if user had session initiated
if(sessionPreferences.getSession())
{
startHome();
}
else
{
setContentView(R.layout.login);
etUsername = ((EditText) findViewById(R.id.txtUsername));
etPassword = ((EditText) findViewById(R.id.txtPassword));
chkRememberMe = (CheckBox) findViewById(R.id.chkRememberMe);
Button btnLogin = (Button) findViewById(R.id.btnLogin);
btnLogin.setOnClickListener(this);
etPassword.setOnEditorActionListener(this);
rememberMe();
}
}
private void startHome()
{
Intent welcome = new Intent("com.login.login.welcome");
welcome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(welcome);
}
QUESTION: How start another activity without loading main activity?
Thank to All ...