private void initViews() { handler = new Handler(); myRunnable = new Runnable() { public void run() { if (!MyApplication.instance.requestNewInterstitial()) { getLocale(); Intent i = new Intent(SplashActivity.this, HomeActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } else { MyApplication.instance.mInterstitialAd.setAdListener(new AdListener() { @Override public void onAdClicked() { super.onAdClicked(); } @Override public void onAdClosed() { super.onAdClosed(); MyApplication.instance.mInterstitialAd.setAdListener(null); MyApplication.instance.mInterstitialAd = null; MyApplication.instance.ins_adRequest = null; MyApplication.instance.loadAds(); getLocale(); Intent i = new Intent(SplashActivity.this, HomeActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } @Override public void onAdFailedToLoad(int i) { super.onAdFailedToLoad(i); } @Override public void onAdLoaded() { super.onAdLoaded(); } }); } } }; handler.postDelayed(myRunnable, getResources().getInteger(R.integer.time_load)); }
Do'stlaringiz bilan baham: |