我正在尝试在用户打开的每个第4个片段上显示admob广告。我试着像下面这样做
我在My常量文件中创建了变量,如下所示
public static int ad_count = 4;
我在每个像下面创建的片段视图中声明这一点
constant.ad_count = constant.ad_count-1;
对于展示广告,我使用的方法如下
private void showInterstitial() {
if(constant.ad_count== 0) {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
//showAd();
}
}
每次广告而不是每个第4个片段打开时都会显示。任何人都可以帮助我解决我的错误吗?