1

嗨,我想分享一个默认内容以及用户想要分享的文本:

    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, " - You're using App v. 10.2");
    sendIntent.setType("text/plain");
    startActivity(sendIntent);


我想要的是这样的:
USER TEXT HERE
- You're using App v. 10.2

我怎样才能做到这一点?谢谢

4

2 回答 2

1

试试这个,

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent .setType("text/html");
sendIntent .putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<p>USER TEXT HERE.</p> <br \> <p>- You're using App v. 10.2</p>"));
startActivity(Intent.createChooser(sendIntent ,"Share using"));
于 2013-01-08T08:47:37.150 回答
0

请检查此代码。它运作良好。

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("*/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Body text of the new status");    
startActivity(Intent.createChooser(shareIntent, "Share image using")); 
于 2013-01-08T09:32:13.957 回答