Android - take the back-stack splash screen

2

I'm finishing a college job where an app should display a splash screen and then a login screen. I wish that as soon as the splash screen was finished, it would go out of the way.

The structure is as follows: S (splash) - > L (Login) - > R (rest of the system). The history is as follows: S, L, R. I would like to have only L, R, because when the user returns to the login screen, the application should close.

The code for the splash screen is this:

package activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import br.bravosix.tarefas.R;

public class SplashActivity extends Activity implements Runnable {

    private Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.layout_splash);

        mHandler.postDelayed(this, 1500);
    }

    @Override
    public void run() {
        Intent login = new Intent(this, LoginActivity.class);
        login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(login);
    }
}

Using the Intent.FLAG_ACTIVITY_CLEAR_TOP flag, suggested as a solution in other questions, did not solve.

    
asked by anonymous 15.06.2014 / 01:50

1 answer

2

See if this resolves:

@Override
public void run() {
    Intent login = new Intent(this, LoginActivity.class);
    startActivity(login);
    finish();
}
    
15.06.2014 / 01:58