Reputation: 2923
I want to implement a fragment as a splash screen, it will be shown for less than 1 second and it will replace itself with an interstitial ad. I want to implement Admob's suggested way of showing interstitial ads. I want to display 'App Loading' screen inside a fragment and hide the fragment when ad is ready. I am doing it inside a fragment instead of a view becuase I need to make this a generic solution and then add it to the my other apps as well.
Upvotes: 2
Views: 1617
Reputation: 1662
Try this code
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// your code here
}
}, TIME_OUT_IN_MILLIS);
Upvotes: 2
Reputation: 1212
Into the onCreate of your Interstitial ad put this code
// This time is in milliseconds
final int SPLASH_TIME_OUT = 3000;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// Code to start new activity and finish this one
}
}, SPLASH_TIME_OUT);
Upvotes: 2