ErhanBicer
5/23/2017 - 7:40 AM

SplashScreen

SplashScreen



import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {
    private PrefManager prefManager;


    SharedPreferences prefs = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTheme(R.style.SplashScreen);
        super.onCreate(savedInstanceState);

        prefs = getSharedPreferences("ilkcalistirma", MODE_PRIVATE);
    }

    @Override
    protected void onStart() {
        super.onStart();


        int secondsDelayed = 1;
        new Handler().postDelayed(new Runnable() {
            public void run() {
                if (prefs.getBoolean("ilkcalistirma", true)) {
                    prefs.edit().putBoolean("ilkcalistirma", false).apply();
                    startActivity(new Intent(SplashActivity.this, IntroActivity.class));
                    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

                } else {
                    startActivity(new Intent(SplashActivity.this, Anasayfa.class));
                    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

                    finish();
                }
            }
        }, secondsDelayed * 1000);
    }





}