Reputation: 1179
I have one Activity in my app. Now I wanted to add an Admob interstitial banner. Unfortunately the old activity is also closed when the user closes the ad.
I added something like this:
interstitial = new InterstitialAd(this, "*************");
// Create ad request
AdRequest adRequest = new AdRequest();
// and begin loading your interstitial
interstitial.loadAd(adRequest);
interstitial.setAdListener(this);
And started the ad by using
if (interstitial.isReady()){
interstitial.show();
}
The representation of the app is working fine.
What can I do to solve the problem?
Upvotes: 1
Views: 1334
Reputation: 2811
There is an attribute in your AndroidManifest.xml file, like android:noHistory="true" You must delete this. it solves the problem
Upvotes: 1
Reputation: 9217
Do like this
private boolean isAddShown = false;
make this isAddShown = true
when the add is visible
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
if(!isAddShown){
super.onBackPressed();
}else{
isAddShown = false;
}
}
Upvotes: 0