Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在8秒内完成Ads_全屏活动,并在活动结束后享用午餐?_Java_Android_Android Layout_Android Intent - Fatal编程技术网

Java 如何在8秒内完成Ads_全屏活动,并在活动结束后享用午餐?

Java 如何在8秒内完成Ads_全屏活动,并在活动结束后享用午餐?,java,android,android-layout,android-intent,Java,Android,Android Layout,Android Intent,启动屏幕的两种情况 如果启用ads,则启动屏幕时间将为2秒,ads_全屏时间将为8秒,然后将出现最终的主要活动 如果未启用ads,则启动屏幕时间将为5秒,然后主要活动将开始 这是启动屏幕的代码 new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i; if (prefManager.isFirstTimeLaunch()){

启动屏幕的两种情况

  • 如果启用ads,则启动屏幕时间将为2秒,ads_全屏时间将为8秒,然后将出现最终的主要活动

  • 如果未启用ads,则启动屏幕时间将为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\u TIME\u OUT
    设置为
    5000
    毫秒

    public final int SPLASH_TIME_OUT = 5000;
    
    用于SplashScreen活动

    用于全屏活动的广告


    谢谢@Dhruv你是最棒的,回答很有魅力!
    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);
    
    SPLASH_TIME_OUT = 8000;
    new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                // start MainActivity
            }
        }, SPLASH_TIME_OUT);