Android 创建一个facebook事件

Android 创建一个facebook事件,android,events,facebook-graph-api,Android,Events,Facebook Graph Api,我做了以下编码: 在onCreate()中,我写道: onCreate()下面的EventReqestListner类如下所示: class EventRequestListener implements com.facebook.android.AsyncFacebookRunner.RequestListener { public void onComplete(final String response) throws JSONException{ Sys

我做了以下编码:

在onCreate()中,我写道:

onCreate()下面的EventReqestListner类如下所示:

     class EventRequestListener implements
com.facebook.android.AsyncFacebookRunner.RequestListener {


public void onComplete(final String response) throws JSONException{         

System.out.println("in oncomplete of friend request listner ....");
String Name= "test";
String Location= "test";
String Description= "desc";
JSONObject event = new JSONObject();
Bundle bundle = new Bundle();
bundle.putString("method","events.create");
event.put("page_id",123454);
event.put("name",Name);
event.put("location",Location);
event.put("start_time", "2013-05-14T10:13:00");
event.put("end_time", "2013-05-15T10:20:00");
event.put("privacy_type", "OPEN");
bundle.putString("event_info",event.toString());

try {
    fc.request("POST", bundle);
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
System.out.println("Event Posted");
}
我的问题是,我没有得到任何错误、异常。此外,我不会创建事件。我对android很陌生,你的帮助真的很有价值。
谢谢

您需要先处理身份验证和登录,然后才能请求用户的事件。这包括请求用户允许您的应用程序检索事件的权限

当前,您的代码实例化了一个Facebook对象。在此之后,您需要对用户进行身份验证并登录。帮助您实现这一点的一些资源包括:

  • 关于如何使用auth和login创建基本Android Facebook应用程序的分步教程:

  • github的Hackbook示例:。这本黑客手册包含了许多在Android应用程序上实现FB功能的有用代码示例。它带有完整的身份验证/登录代码

  • 对这本黑客书的一部分进行浏览


此外,您的RequestListener代码没有正确执行。它目前正试图将数据发布到FB。它通常用于解析来自FB的数据。查看上面链接中的示例,了解如何使用RequestListener

非常感谢!,我会把它们全部看一遍……)
     class EventRequestListener implements
com.facebook.android.AsyncFacebookRunner.RequestListener {


public void onComplete(final String response) throws JSONException{         

System.out.println("in oncomplete of friend request listner ....");
String Name= "test";
String Location= "test";
String Description= "desc";
JSONObject event = new JSONObject();
Bundle bundle = new Bundle();
bundle.putString("method","events.create");
event.put("page_id",123454);
event.put("name",Name);
event.put("location",Location);
event.put("start_time", "2013-05-14T10:13:00");
event.put("end_time", "2013-05-15T10:20:00");
event.put("privacy_type", "OPEN");
bundle.putString("event_info",event.toString());

try {
    fc.request("POST", bundle);
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
System.out.println("Event Posted");
}