OnBackPressed()函数工作正常,但当我显示插页式广告时,我将 onAdClose 侦听器,当用户关闭广告时,我只是回到之前的活动。问题是控制立即回到之前的活动,之后3-10秒显示先前活动的但视图。我正在粘贴代码,让我知道anAdClose()侦听器或其他什么问题?谢谢
@Override
public void onBackPressed() {
if (activityCount > 4) {
if(commonInterstitialAd.isLoaded()){
commonInterstitialAd.show();
}else{
super.onBackPressed();
return;
}
commonInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
activityCount = 0;
activity.super.onBackPressed();
}
});
} else {
super.onBackPressed();
}