Skip User registration activities already logged in the application

0

Good afternoon.

I'd like to know the best way to skip Activities registration when initializing the application on Android when the user is already registered in the application, as in Facebook and other applications that require login.

The ideal way would be to query the SQLite database if the user is already existing and create a Intent in the creation of that first Activity and immediately redirect to another Activity ? Or what other way would they use it? Is there a way to access the application without creating the Activity that the application starts for the first time?

    
asked by anonymous 04.09.2015 / 22:18

1 answer

2

Your initial activity may be like this (note that there is no setContentView() ):

public class ActivityInicial extends Activity {

    @Override
    public void onCreate() {
        if (usuarioLogado()) {
            chamarActivityPrincipal();
        } else {
            chamarActivityDeLogin();
        }
        finish();
    }
}
    
04.09.2015 / 22:34