我已经在 Android 中使用 Facebook 创建了邀请用户到应用程序,为此使用了 Facebook SDK 并添加了人们给出的代码,这是我的代码
final ImageView facebook1 = (ImageView) findViewById(R.id.facebook1);
facebook1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
// Perform action on click
Facebook facebook1 = new Facebook("APP_ID");
Bundle paramsOut = new Bundle(), paramsIn = this.getIntent().getExtras();
paramsOut.putString("message", paramsIn.getString("message"));
Singlemenuitem.this.mFacebook.dialog(this, "apprequests", paramsOut, new InviteListener(this));
mFacebook.dialog(Singlemenuitem.this, "apprequests", params, new DialogListener() {
public void onComplete(Bundle values) {
final String returnId = values.getString("request");
if (returnId != null) {
Toast.makeText(getApplicationContext(),
"Request sent " + returnId,
Toast.LENGTH_SHORT).show();
}
}
public void onFacebookError(FacebookError error) {}
public void onError(DialogError e) {}
public void onCancel() {}
});
}
但是代替“InviteListener”创建类时出错,如果创建了类,那么也会出错。有什么指导吗?