怎麼實現分享

有不少時候咱們須要分享應用中的信息到Facebook,Twitter,短信等。。it

1建立一個Intent分享

Intent sharingIntent = new Intent(Intent.ACTION_SEND);vi

2 分享內容的格式ant

sharingIntent.setType("text/plain");new

3添加內容(短信或是Twitter有字數限制)tar

sharingIntent.putExtra(Intent.EXTRA_TEXT,"Here the body");

startActivity(Intent.createChooser(sharingIntent,"How do you want to share?"));

相關文章
相關標籤/搜索