2015-10-13 76 views
1

我想根據用戶選擇的應用程序分享不同的信息。例如,我想向Gmail發送較短的文本,而不是Gmail(否則,我將以字符爲單位)。無論如何要實現這一目標?獎金問題,是否可以通過Gmail或SMS共享製作超鏈接。例如,「下載這裏」,其中「這裏」是「通過點擊下面的鏈接下載地址:http:// ...」的鏈接,而不是Android - 共享對話框 - 根據所選應用程序的不同意圖?

當前代碼:

Intent shareIntent = new Intent(Intent.ACTION_SEND); 
shareIntent.putExtra(Intent.EXTRA_TEXT, getTextToShare(data)); 
shareIntent.setType("text/plain"); 
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle()); 
startActivity(Intent.createChooser(shareIntent, "Share this story")); 

回答

0

通過使用下面的代碼可以幫助你:

String shareText="Download <a href='[download link]'>here</a>"; 
Intent shareIntent = new Intent(Intent.ACTION_SEND); 
shareIntent.putExtra(Intent.EXTRA_TEXT, Html.toHtml(shareText)); 
shareIntent.setType("text/plain"); 
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle()); 
startActivity(Intent.createChooser(shareIntent, "Share this story")); 

Share Url Links and Texts into Social Networks (Facebook,Twitter and linkedin)

相關問題