【发布时间】:2019-09-03 12:20:31
【问题描述】:
当我单击返回按钮或从上一个活动返回时,会显示插页式广告。但是我想在用户从活动 1 转到活动 2 时显示广告。当我稍微更改代码时,插页式广告会显示,但它会阻止将用户发送到活动 2。
从活动 1 转到活动 2 后按返回按钮时显示插页式广告的代码。
public void ok(View view) {
if (InterstitialAd.isLoaded())
InterstitialAd.show();
Intent intent = new Intent ( WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(this, WallpaperService.class));
startActivity(intent);
}
显示插页式广告但阻止用户进行活动的代码 2
public void ok(View view) {
Intent intent = new Intent ( WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(this, WallpaperService.class));
startActivity(intent);
if (InterstitialAd.isLoaded())
InterstitialAd.show();
}
【问题讨论】: