如何在8秒内完成Ads_Fullscreen活动并在病房结束后午餐MainActivity? [英] How to finish the Ads_Fullscreen Activity in 8 seconds and lunch the MainActivity after wards?

查看:83
本文介绍了如何在8秒内完成Ads_Fullscreen活动并在病房结束后午餐MainActivity?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动画面的两种情况

  1. 如果启用了广告,则启动画面"时间为2秒,而广告_全屏"时间为8秒,则最终的主要活动"将会到来.

  1. if ads is enable then Splash Screen time will be 2 seconds and Ads_Fullscreen time will be 8 seconds then final Main Activity will come.

如果未启用广告,则启动画面"时间将为5秒,然后将出现主要活动".

if ads is not enable then Splash Screen time will be 5 seconds and then Main Activity will come.

这是启动画面的代码

 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活动

For SplashScreen Activity

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活动

For Ads_Fullscreen Activity

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

这篇关于如何在8秒内完成Ads_Fullscreen活动并在病房结束后午餐MainActivity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆