首页 > 其他 > 详细

用Intent分享的代码

时间:2015-09-14 19:46:43      阅读:171      评论:0      收藏:0      [点我收藏+]
  1. private void share(String content, Uri uri){  

  2.     Intent shareIntent = new Intent(Intent.ACTION_SEND);   

  3.     if(uri!=null){  

  4.         shareIntent.putExtra(Intent.EXTRA_STREAM, uri);  

  5.         shareIntent.setType("image/*");   

  6.         //当用户选择短信时使用sms_body取得文字  

  7.         shareIntent.putExtra("sms_body", content);  

  8.     }else{  

  9.         shareIntent.setType("text/plain");   

  10.     }  

  11.     shareIntent.putExtra(Intent.EXTRA_TEXT, content);  

  12.     //自定义选择框的标题  

  13.     //startActivity(Intent.createChooser(shareIntent, "邀请好友"));  

  14.     //系统默认标题  

  15.     startActivity(shareIntent);  

  16. }  


用Intent分享的代码

原文:http://my.oschina.net/u/1463920/blog/505980

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!