quinta-feira, 9 de abril de 2015

Android: Splash Screen with Delay

public class MainActivity extends BaseActivity implements IResponse {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);

        this.Inicializar();

    }
    protected void Inicializar(){
        new Handler().postDelayed(new Runnable(){
            @Override
            public void run() {
                DatabaseController.CreateDatabase(MainActivity.this);
                Intent i = new Intent(MainActivity.this, frmLogin.class);
                i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(i);
            }
        }, AppConfig.SPLASH_DISPLAY_LENGTH);
    }

    public void onResponse(Response mensagem) {
    }

    @Override
    public void onResume() {
        super.onResume();
        this.Inicializar();
    }
}
Postar um comentário