Java 通过调用不同类的方法显示间隙广告?(StartApp)
所以,因为我试图将游戏货币化,这就有点困难了,因为java类中没有“Java 通过调用不同类的方法显示间隙广告?(StartApp),java,android,eclipse,interstitial,startapp,Java,Android,Eclipse,Interstitial,Startapp,所以,因为我试图将游戏货币化,这就有点困难了,因为java类中没有“public void onCreate”方法,我需要在其中调用ads。添加横幅对我来说不是问题,但我不能调用它。在我的主java类中,我创建了一个方法: public void showInter(){ startAppAd.showAd(); startAppAd.loadAd(); } 所以在另一个类中,我制作了“MainClass example=newmainclass();”
public void onCreate
”方法,我需要在其中调用ads。添加横幅对我来说不是问题,但我不能调用它。在我的主java类中,我创建了一个方法:
public void showInter(){
startAppAd.showAd();
startAppAd.loadAd();
}
所以在另一个类中,我制作了“
MainClass example=newmainclass();
”,当游戏结束时,我调用“example.showInter()
”,但广告不会显示。有人有解决办法吗?我至少不能以正常方式在此类中创建StartAppAd
对象。在使用它之前是否初始化了StartAppAd
private StartAppAd startAppAd = new StartAppAd(this);
您还可以使用AdEventListener获取加载广告的回调,并检查广告失败的原因:
不应该在放映前加载吗?不,顺序正确。