0
我嘗試使用ShareActionProvider(support.v7
)爲我的應用執行共享。所有的應用程序,如Gmail,Evernote等。 al,工作很好 - 除了Facebook。我不知道問題是什麼。這裏是我的一小段代碼片段:Android ShareActionProvider未能分享到Facebook
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.share, menu);
MenuItem shareItem = menu.findItem(R.id.action_share);
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
mShareActionProvider.setShareIntent(shareIntent());
return true;
}
public Intent shareIntent() {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("type/plain");
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_SUBJECT,"SUBJECT");
shareIntent.putExtra(Intent.EXTRA_TEXT,"TEXT TEXT");
return shareIntent;
}
非常感謝,你救了我一個小時!關於將圖片分享到Facebook,我可以使用外部鏈接,如「http://www.abc.com/abc.png」嗎? – user2761885
@ user2761885:通常共享是針對本地內容的。我不能說Facebook是否支持這種方式共享鏈接。 – CommonsWare
非常感謝!!!!!!! – user2761885