Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.izzaweb.bengkel.Ui;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.v7.app.AppCompatActivity;
- import com.izzaweb.bengkel.MainActivity;
- import com.izzaweb.bengkel.R;
- import com.izzaweb.bengkel.SessionManager.UserSession;
- public class SplashscreenAct extends AppCompatActivity {
- UserSession userSession;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_splashscreen);
- userSession = new UserSession(SplashscreenAct.this);
- Thread timerThread = new Thread(){
- public void run(){
- try {
- sleep(3000);
- }
- catch (InterruptedException e){
- e.printStackTrace();
- }finally {
- if (userSession.isUserLoggedIn()){
- Intent intent = new Intent(SplashscreenAct.this,MainActivity.class);
- startActivity(intent);
- }else{
- Intent intent = new Intent(SplashscreenAct.this,LoginActivity.class);
- startActivity(intent);
- }
- }
- }
- };
- timerThread.start();
- }
- @Override
- protected void onPause() {
- // TODO Auto-generated method stub
- super.onPause();
- finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement