我想在我的动态壁纸设置上实现 Appbrain 插页式广告,
我按照 - http://www.appbrain.com/info/sdk-docs/interstitial.html 上给出的步骤进行操作
@Override
public void onBackPressed() {
AppBrain.getAds().maybeShowInterstitial(this);
finish();
}
注意:onBackPressed() 上的 eclipse 红色下划线
eclipse 给出错误:
The method onBackPressed() of type SBLiveWallpaper must override or implement a supertype method
一个快速修复方法是:删除 @override 注释
解决办法是什么?
更新:这是屏幕截图: http://prntscr.com/558my0
最佳答案
由于 Eclipse 本身为您提供了捕获异常解决方案的提示
The method onBackPressed() of type SBLiveWallpaper must override or implement a supertype method
您的类SBLiveWallpaper
必须扩展一个Activity
类,该类具有onBackPressed()
方法,因此只有当您时才可以覆盖该方法直接或间接扩展 Activity
类。
喜欢:
public SBLiveWallpaper extends Activity {
@Override
public void onBackPressed() {
AppBrain.getAds().maybeShowInterstitial(this);
finish();
}
}
关于java - onBackPressed() 覆盖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26857669/