我做了以下编码:
在 onCreate() 里面我写道:
Facebook fc = new Facebook("392736034134808");
AsyncFacebookRunner mAsuncRunner = new AsyncFacebookRunner(fc);
mAsuncRunner.request("/me/events",new EventRequestListener());
我在 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很陌生,你的帮助真的很有价值。谢谢!!