我设置了按钮触发的Admob插页式广告,以获得以下结果,
广告显示完美,并在广告显示后继续播放视频,但问题是如果我点击后退按钮再次点击按钮,它会重现应用崩溃并停止应用。我在谷歌搜索问题,但仍然没有运气。
以下是我整合广告的代码
img_ply.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
mAdView = (AdView) findViewById(R.id.adView);
mAdView.loadAd(new AdRequest.Builder().build());
mInterstitial.setAdUnitId(getResources().getString(R.string.admob_intertestial_id));
mInterstitial.loadAd(new AdRequest.Builder().build());
mInterstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// TODO Auto-generated method stub
super.onAdLoaded();
if (mInterstitial.isLoaded()) {
mInterstitial.show();
mInterstitial.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
super.onAdClosed();
Intent inttv = new Intent(SingleChannelActivity.this, TvPlay.class);
inttv.putExtra("url", ChannelUrl);
startActivity(inttv);
}
});
}else{
super.onAdLoaded();
}
}
});
}
});
答案 0 :(得分:0)
尝试使用“mInterstitial.loadAd(new AdRequest.Builder()。build());”再次在你的onAdClosed()方法中。