2
我正在從事在線教程中的分享功能,我找到了示例代碼並創建了這樣的功能。但它也有一些缺點(還有,如果我安裝了很多應用程序的太多選項),等等,總之,我想做到以下幾點:如何在android中創建「一般」共享意圖?
- 嚴格的選項影的Gmail
- 如何分享圖像(如果我爲它提供的鏈接?(微博似乎接受純文本格式))
- 下面的代碼顯示沒有在Facebook的應用程序?(不能在Facebook上共享數據)
這裏是我的代碼:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
try {
String newsUrl = Html.fromHtml(URLDecoder.decode(content[0], "UTF-8")).toString().replace("appfunc://share=", "");
String title = Html.fromHtml(URLDecoder.decode(content[1], "UTF-8")).toString();
String newsContent = Html.fromHtml(URLDecoder.decode(content[2], "UTF-8")).toString();
if (!newsContent.equals(""))
newsContent += "...\n\n";
sendIntent.putExtra(Intent.EXTRA_TEXT, title + "\n\n" + newsContent + ctx.getResources().getString(R.string.link) + ": " + newsUrl);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
sendIntent.putExtra(Intent.EXTRA_TEXT, ctx.getResources().getString(R.string.share_placeholder));
e.printStackTrace();
};
ctx.startActivity(Intent.createChooser(sendIntent, ctx.getResources().getString(R.string.share_to)));
Facebook [不支持預填寫帖子](https://developers.facebook.com/x/bugs/332619626816423/)。 – mgorven
是否有可能不使用他們的SDK來實現Facebook共享?謝謝 – user782104