2013-08-22 12 views
1

我想通過Android客戶端分享一些信息。 這段代碼在Gmail,Evernote,Twitter,Viber,Whatsapp等中運行良好,但它在Facebook中無法使用,因爲它們不支持EXTRA_TEXT字段(aaargh!)。Facebook意向分享 - 需要解決方法

Intent sharingIntent = new Intent(Intent.ACTION_SEND); 
sharingIntent.setType("text/plain"); 
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test message"); 
sharingIntent.putExtra(Intent.EXTRA_TEXT, text); 
startActivity(Intent.createChooser(sharingIntent,"Share using")); 

所以我想到了一種可能的解決方案。當用戶點擊分享按鈕時,我創建了一個新的對話框,提供在Facebook和其他人上共享。藉助Facebook SDK,我可以在Facebook上分享文字,圖片等。當用戶點擊其他時,正常的分享意圖應該與所有客戶端一起出現,但是沒有facebook應用

這可能嗎?你有其他想法來做這個工作嗎?

回答