在关注facebook的移动应用指南时出错

时间:2011-09-13 23:23:57

标签: facebook mobile

当我在课堂上输入时:

package com.greatap;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.android.*;
import com.facebook.android.Facebook.*;

public class MyGreatActivity extends Activity {

    Facebook facebook = new Facebook("YOUR_APP_ID");

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        facebook.authorize(this, new DialogListener() {
            @Override
            public void onComplete(Bundle values) {}

            @Override
            public void onFacebookError(FacebookError error) {}

            @Override
            public void onError(DialogError e) {}

            @Override
            public void onCancel() {}
        });
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        facebook.authorizeCallback(requestCode, resultCode, data);
    }
}

我收到这些错误:

FacebookError cannot be resolved to a type,
Syntax error on token "*", delete this token,
The import com.facebook.android.Facebook cannot be resolved,
The method onCancel() of type new DialogListener(){} must override a superclass method,
The method onComplete(Bundle) of type new DialogListener(){} must override a superclass method,
Facebook cannot be resolved to a type,
DialogListener cannot be resolved to a type,
DialogError cannot be resolved to a type.

如果有人能帮助我找出我做错了什么,我将不胜感激!提前谢谢!

1 个答案:

答案 0 :(得分:1)

更改项目首选项以使用Java 1.6而不是1.5。此错误是因为使用Java 1.5。

link:'Must Override a Superclass Method' Errors after importing a project into Eclipse