1
我得到一個 當metd startActivityForResult(Intent,int)必須重寫一個超類methed「試圖從facebook sdk編譯代碼時。獲取錯誤說我必須重載超類方法,但父類有該方法來覆蓋
我之前問過這個問題,並得到了emper的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;
}
};
}
嗨,非常感謝。 Facebook說我可以使用5.0或6.0版本。認爲舊版本會更好。我從來不會想到這一點,謝謝:) –