https://developers.facebook.com/docs/mobile/android/build/
在以下网站中的以下给定代码中发生错误
package com.greatapp;
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);
<i> setContentView(R.layout.main); < i> I have gotten error here
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);
}
}
setContentView(R.layout.main);
main
该错误告诉我们在 type
中创建一个字段layout
。我试过了,但R.java
文件不能手动修改。我该如何解决这个错误?