在初始屏幕后转到另一个 activity 而不是主要 activity

Go to another activity not main activity after splash screen

我有一个初始屏幕,我在其中检查用户是否已登录,如果已登录,请转到仪表板,否则请转到登录 activity。我正在使用 sharedpref。问题是(我无法解决)启动屏幕登录屏幕比仪表板出现了一小会儿。 Splash > Login > Dash 我想要的是 Splash > Dash(如果用户登录)。登录是我项目的主要activity。这是代码:

public class SplashScreen extends AppCompatActivity {

private SessionManager sessionManager;
private BroadcastReceiver broadcastReceiver;
private SharedPreferences prefs;
private boolean isLogin;
private int accessID;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sessionManager = new SessionManager(this);
    broadcastReceiver = new CheckNetStatus();
    broadcastIntent();
}

@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onResume(){

    super.onResume();

    new CheckNetStatus().onReceive(SplashScreen.this,new 
 Intent(ConnectivityManager.CONNECTIVITY_ACTION));

    try {
        prefs = getSharedPreferences(SessionManager.PREF_NAME, 0); // Declare 
     SharedPreferences
        accessID = prefs.getInt(SessionManager.KEY_ACCESSID, 0); // get Access Id from 
   SharedPreferences
        isLogin = Utils.getLoginStatus(SplashScreen.this); // Check Login is true or false

    


    } catch (Exception e) {
        e.printStackTrace();
    }

    Thread splashTread = new Thread() {

        @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void run() { // run thread
            try {
                synchronized (this) {
                    Thread.sleep(3000); // Screen stay for 3 sec.
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (isLogin)
                {
                //    if (accessID == 0) { // access Id is ZERO open AddMoneyActivity.class
                //        try {
                //            } catch (Exception e) {
                //            e.printStackTrace();
                //        }
                //    } else if (accessID == 1) {// access Id is ONE open 
      ProfileStepOneActivity.class
                        try {
                            Intent intent = new Intent(SplashScreen.this, Dashboard.class);
                           
                            startActivity(intent);
                            finishAffinity(); // Finish stack
                        } catch (Exception e) {
                            e.printStackTrace();
                        }


            } else {// Login is False  goto Login  Activity
                try {
                    Intent intent = new Intent(SplashScreen.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
};
    splashTread.start();
  }

public void broadcastIntent() {
    registerReceiver(broadcastReceiver, new 
   IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
   }



@Override
protected void onPause() {
    super.onPause();
    try {
        LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver);
        //unregisterReceiver(broadcastReceiver);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

@Override
protected void onStop(){
    super.onStop();
    try {
        LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver);
 //            unregisterReceiver(broadcastReceiver);
    } catch (Exception e) {
        e.printStackTrace();
        }

   }
   }

我的错误....我正在重定向到主 activity 即登录 activity 在 netstats class(我正在检查网络连接)即为什么它显示登录问题现在已解决