0

我想張貼圖片,消息,標題,link.expect圖像剩下張貼罰款。 如果我給的網址圖片吧work.but我想送繪製image.image沒有張貼 我嘗試下面的代碼:張貼可繪製的圖像到朋友的牆壁上是不是在facebook上張貼android

class LoginDialogListener implements DialogListener { 
    public void onComplete(Bundle values) { 

     publishFeedDialog(); 

    } 
    public void onFacebookError(FacebookError error) { 
     showToast("Authentication with Facebook failed!"); 
     finish(); 
    } 
    public void onError(DialogError error) { 
     showToast("Authentication with Facebook failed!"); 
     finish(); 
    } 
    public void onCancel() { 
     showToast("Authentication with Facebook cancelled!"); 
     finish(); 
    } 
} 



private void publishFeedDialog() { 
    final Bundle params = new Bundle(); 
    final Bitmap bit=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); 
    ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
    bit.compress(CompressFormat.JPEG, 100, baos); 
    byte[] data = baos.toByteArray(); 


    params.putString("to", Universal.ids); 
    params.putString(Facebook.TOKEN, facebook.getAccessToken()); 
    params.putString("name", "Sending a birthday card!"); 
    params.putString("link", "https://play.google.com/store/search?q=dbgr&c=apps&hl=en"); 
    params.putString("description", "Wishing You a HAPPY BIRTHDAY"); 
    params.putString("picture", data); 



    facebook.dialog(this, "feed", params, new DialogListener() { 

     @Override 
     public void onFacebookError(FacebookError e) { 
      // TODO Auto-generated method stub 
      showToast("Authentication with Facebook failed!"); 
      finish(); 
     } 

     @Override 
     public void onError(DialogError e) { 
      // TODO Auto-generated method stub 
      showToast("Authentication with Facebook failed!"); 
      finish(); 
     } 

     @Override 
     public void onComplete(Bundle values) { 
      // TODO Auto-generated method stub 
      showToast("Post is successfully sent"); 
      finish(); 
      Intent i=new Intent(getApplicationContext(),FrndActivity.class); 
      startActivity(i); 

     } 

     @Override 
     public void onCancel() { 
      // TODO Auto-generated method stub 
      showToast("Authentication with Facebook cancelled!"); 
      finish(); 
     } 
    }); 

圖像不posting.please幫助我。

回答

0

供稿對話框的「圖片」參數不支持上傳位圖,只有url。

https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.0

+0

感謝reply.which方法是用來張貼位圖從drawable。 – user3331192

+0

查看FacebookDialog類(它將要求您使用新的API,因爲從您的代碼中看,您似乎仍在使用獲取訪問令牌的舊的棄用方式) - https://developers.facebook .com/docs/reference/android/current/class/FacebookDialog/ 在那裏分享的方式很多,他們需要安裝Facebook應用程序。 –

+0

謝謝reply.i有另一個問題,我收到朋友的個人資料圖片有名字,並設置在列表視圖,但個人資料圖片不匹配那裏names.picture不正確 – user3331192