2012-03-22 91 views
0

我的Facebook SDK新手,我需要創建一個應用程序的Android SDK的Facebook個人資料飼料

我知道如何張貼到牆上,檢查,得到的朋友,

但我不知道如何獲取配置文件(Wall)和朋友飼料

需要使用Graph API?

但我不明白圖形API如何使用

+0

那麼,什麼是你的問題? – goodm 2012-03-22 10:53:48

+0

如何做簡介Feed(牆)? – Chicken 2012-03-22 10:56:43

回答

1

與Facebook彈出:

public void share(String day, String points) 
{ 
    Bundle params = new Bundle(); 
    params.putString("name", XXXXXXXX); 
    params.putString("caption", XXXXXXXX); 
    params.putString("link", XXXXXXXX); 
    params.putString("description",XXXXXXXX); 
    facebook.dialog(this, "stream.publish",params , new WallPostDialogListener());  
} 

class WallPostDialogListener implements DialogListener 
{ 
    public void onComplete(Bundle values) 
    { 
     if(data.facebook == true) 
     { 
      Log.e("SHARE",values.toString()); 
      if(values.getString("post_id")!=null) 
      { 

      } 
     } 

    } 
    public void onFacebookError(FacebookError e) 
    { 
     Log.d("PostToWall","Facebook Error"); 
    } 
    public void onError(DialogError e) 
    { 
     Log.d("PostToWall","Dialog error"); 
    } 
    public void onCancel() 
    { 
     Log.d("PostToWall","Cancel"); 
    } 
} 

,沒有Facebook的對話框:

Bundle parameters = new Bundle(); 
parameters.putString("name", XXXXXXXX); 
parameters.putString("message", XXXXXXXX); 
parameters.putString("link", XXXXXXXX); 
response = facebook("me/feed", parameters, "POST"); 

嘗試:https://developers.facebook.com/docs/reference/api/

例如: (我不知道這是否有效)

Bundle parameters = new Bundle(); 
response = facebook("me/feed", parameters, "GET"); 
JSONObject feeds = new JSONObject(); 
try 
{ 
    feeds = new JSONObject(response); 
} 
catch(JSONException e) 
{} 

或:

AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); 
mAsyncRunner.request("me/feed", new FeedsRequestListener()); 

    private class FeedsRequestListener implements RequestListener 
    {   
      @Override 
      public void onComplete(String response, Object state) 
      { 
        try 
        { 
          JSONObject json = Util.parseJson(response); 
        } 
        catch (JSONException e) 
        { 
          Log.e("OnComplete","JSONException"); 
        } 
        catch (FacebookError e) 
        { 
          Log.e("OnComplete","FacebookError"); 
        } 
      } 
      @Override 
      public void onIOException(IOException e, Object state) 
      { 
        Log.e("FeedsRequest","onIOException " + e.toString()); 
      } 
      @Override 
      public void onFileNotFoundException(FileNotFoundException e,Object state) 
      { 
        Log.e("FeedsRequest","onFileNotFoundException " + e.toString()); 
      } 
      @Override 
      public void onMalformedURLException(MalformedURLException e,Object state) 
      { 
        Log.e("FeedsRequest","onMalformedURLException " + e.toString()); 
      } 
      @Override 
      public void onFacebookError(FacebookError e, Object state) 
      { 
        Log.e("FeedsRequest","onFacebookError " + e.toString()); 
      } 
    } 
+0

這是張貼到牆上的代碼? 我需要diaplay新聞反饋和配置文件飼料~~ 順便說一句,謝謝〜! – Chicken 2012-03-23 05:40:55

+0

非常感謝但是如何在tableview或其他視圖中顯示 – Chicken 2012-04-02 15:39:38

相關問題