Я хочу показать вставку после экрана spla sh и до того, как появится основная активность. Вот мой экранный код spla sh:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.Interstitial_AdMob));
mInterstitialAd.loadAd(new AdRequest.Builder().build());
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
mInterstitialAd.loadAd(new AdRequest.Builder().build());
}
});
image = (ImageView) findViewById(R.id.splash_main) ;
Animation myanim = AnimationUtils.loadAnimation(this,R.anim.a_text);
image.startAnimation(myanim);
final Intent i = new Intent(this, Home.class);
Thread timer = new Thread() {
public void run () {
try {
sleep(5000);
}catch (InterruptedException e) {
e.printStackTrace();
}
finally {
startActivity(i);
finish();
}
}
};
timer.start();
}
}