尝试从 facebook sdk 编译代码时,我得到一个“方法 startActivityForResult(Intent,int) 必须覆盖超类方法”。
我之前问过这个问题,并得到了 eeror 消息是他们的印象,因为他们没有超类可以覆盖。
我查看了 Facebook 示例代码,看看它是否有要覆盖的类,它确实有。我可以取出线路以使错误消失。
我想知道是否有人可以解释为什么当错误似乎没有退出时我会收到此错误。(我还在学习java从来没有过课程)代码:
interface StartActivityDelegate {
/* THIS IS THE METHED THAT’S BEING OVERIDE BELOW AND
* I GET A ERROR MESSAGE DON’T UNDERSTAND WHY I’M GETTING
*THE ERROR MESSAGE WHEN THE SUPER METHOD EXISTS */
public void startActivityForResult(Intent intent, int requestCode);
public Activity getActivityContext();
}
void setContext(final Context context) {
this.context = context;
// We rely on individual requests to tell us how to start an activity.
startActivityDelegate = null;
}
void setContext(final Activity activity) {
this.context = activity;
// If we are used in the context of an activity, we will always use that activity to
// call startActivityForResult.
startActivityDelegate = new StartActivityDelegate() {
/* THIS IS WHERE I GET THE ERRROR MESSAGE
* “The methed startActivityForResult(Intent,int) must override a
* superclass methed”*/
@Override
public void startActivityForResult(Intent intent, int requestCode) {
activity.startActivityForResult(intent, requestCode);
}
@Override
public Activity getActivityContext() {
return activity;
}
};
}