android:interstitalad:StartUp必须实现继承的抽象方法 错误:
Eclipse报告公共类启动时出现错误,“类型启动必须实现继承的抽象方法AdListener.onPresentScreen(Ad)”android:interstitalad:StartUp必须实现继承的抽象方法 错误:,android,layout,interstitial,Android,Layout,Interstitial,Eclipse报告公共类启动时出现错误,“类型启动必须实现继承的抽象方法AdListener.onPresentScreen(Ad)” 请问这是什么?如何解决?非常感谢 无法实例化抽象类。您必须创建一个实现抽象类的“具体”或真实类,您已经完成了这项工作 抽象类还可以定义具体类必须提供的抽象方法。在本例中,您没有为onPresentScreen()提供方法,因此出现了错误 有关如何实现此方法的信息,请参阅AdListener文档,该方法在广告全屏显示时调用 import com.google.a
请问这是什么?如何解决?非常感谢 无法实例化抽象类。您必须创建一个实现抽象类的“具体”或真实类,您已经完成了这项工作 抽象类还可以定义具体类必须提供的抽象方法。在本例中,您没有为onPresentScreen()提供方法,因此出现了错误 有关如何实现此方法的信息,请参阅AdListener文档,该方法在广告全屏显示时调用
import com.google.ads.*;
import com.google.ads.AdListener;
import com.google.ads.AdRequest;
import com.google.ads.InterstitialAd;
public class StartUp extends Activity implements AdListener {
private InterstitialAd interstitialAd;
AdView adView;
public static final String MY_PUBLISHER_ID = "abc";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); // call the superclass's method
setContentView(R.layout.main_first_page); // inflate the GUI
interstitialAd = new InterstitialAd(this, MY_PUBLISHER_ID); // Create an ad.
interstitialAd.setAdListener(this); // Set the AdListener.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
interstitialAd.loadAd(adRequest);
if (interstitialAd.isReady()) {interstitialAd.show();}
Button ButtonIQ= (Button) findViewById(R.id.buttonA);
}
谢谢你的帮助!我已经在PresentScreen、onLeaveApplication等上添加了这些,然后就没有更多的错误了!然而,当我尝试运行这些应用程序时,没有显示这样的广告弹出窗口。为什么?(它可以在接收时正确执行)请将此标记为答案,因为它解决了问题,然后用新问题开始另一个问题。请记住张贴相关代码。StackOverflow的效果最好,每篇文章只有一个问题。谢谢
@Override
public void onPresentScreen() {
// called when a full screen ad is presented
}