启动画面的两种情况


如果启用了广告,则“启动画面”时间为2秒,而“广告_全屏”时间为8秒,则最终的“主要活动”将会到来。
如果未启用广告,则“启动画面”时间为5秒,然后出现“主要活动”。


这是启动画面的代码

 new Handler().postDelayed(new Runnable() {
      @Override
      public void run() {
          Intent i;
          if (prefManager.isFirstTimeLaunch()){
              i = new Intent(SplashScreen.this,WelcomeActivity.class);
              prefManager.setFirstTimeLaunch(false);
          }else if(bn_bstatus.equals("enable")) {
              i = new Intent(SplashScreen.this,Ads_Fullscreen.class);

          }else{
              i = new Intent(SplashScreen.this,MainActivity.class);
          }
          startActivity(i);
          finish();
      }
  },SPLASH_TIME_OUT);

最佳答案

将默认SPLASH_TIME_OUT设置为5000毫秒。

public final int SPLASH_TIME_OUT = 5000;



  对于SplashScreen活动


final Intent intent;
if (ads.enable()) {
    intent = new Intent(SplashScreen.this, WelcomeActivity.class);
    prefManager.setFirstTimeLaunch(false);
} else if (bn_bstatus.equals("enable")) {
    intent = new Intent(SplashScreen.this, Ads_Fullscreen.class);
    SPLASH_TIME_OUT = 2000;
} else {
    intent = new Intent(SplashScreen.this, MainActivity.class);
}
new Handler().postDelayed(new Runnable() {
    @Override
    public void run() {
        startActivity(intent);
        finish();
    }
}, SPLASH_TIME_OUT);



  对于Ads_Fullscreen活动


SPLASH_TIME_OUT = 8000;
new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            // start MainActivity
        }
    }, SPLASH_TIME_OUT);

07-27 16:53