我一般都是android开发的新手,但我已经掌握了基础知识。我想使用facebook SDK创建一个Android应用程序,虽然我还没有找到关于使用哪些方法或类的可靠信息来源。 我试图在Facebook开发人员上关注android教程,但我陷入了我应该构建和运行项目的步骤:
Step 6.4: Build and run the project
Build and run the 'MyGreatApp' project. This should launch in the same emulator where you install the Facebook.apk. You will be prompted with the user authorization dialog (You may have to login to the Facebook app if not already done so):
但提供的代码似乎在这些行中有错误:
facebook.authorize(this, new DialogListener(){
@Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
它说:
- 从facebook类型授权的方法是指缺少的类型活动。
- 新的Facebook.DialogListener(){}类型必须实现继承的抽象方法Facebook.DialogListener.onComplete(Bundle)
@Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
- 类型new Facebook.DialogListener(){}的方法onComplete(Bundle)必须覆盖或实现超类型方法
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
- 来自Facebook类型的方法authorizeCallback(int,int,Intent)引用缺少的类型Intent
答案 0 :(得分:4)
老兄转到这个链接https://github.com/facebook/facebook-android-sdk/tree/master/examples/Hackbook/src/com/facebook/android它提供了FB for android的完整编码