2011-12-13 40 views
1

我想制作Facebook应用程序。我在其中做了一个按钮。我想当我们点击按钮后,我们可以通过Facebook SDK显示所有事件。在这我们想要显示creted事件和生日也。显示Facebook的所有活动

请为我提供一个示例代码。我知道这个问题不好。但我需要这方面的帮助。因为我是Android新手。

在此先感谢... !!!

回答

2
mAsyncRunner.request("me/events", new EventRequestListener()); 

private class EventRequestListener implements RequestListener { 

    @Override 
    public void onComplete(String response, Object state) { 
     try { 
      // process the response here: executed in background thread 
      Log.d("response", "Response: " + response.toString()); 
      final JSONObject json = new JSONObject(response); 
      JSONArray d = json.getJSONArray("data"); 

     // then post the processed result back to the UI thread 
     // if we do not do this, an runtime exception will be generated 
     // e.g. "CalledFromWrongThreadException: Only the original 
     // thread that created a view hierarchy can touch its views." 
     } catch (JSONException e) { 
      Log.w("json", "JSON Error in response"); 
     } 
    } 
    @Override 
    public void onIOException(IOException e, Object state) {} 
    @Override 
    public void onFileNotFoundException(FileNotFoundException e,Object state) {} 
    @Override 
    public void onMalformedURLException(MalformedURLException e,Object state) {} 
    @Override 
    public void onFacebookError(FacebookError e, Object state) {} 
} 

现在只是解析该响应。

+0

我已经这样做了。但我想成为像当前事件和我朋友当前生日那样的所有数据。 –

相关问题