首页 > 其他 > 详细

完美实现同时分享图片和文字(Intent.ACTION_SEND)

时间:2015-10-19 17:05:59      阅读:393      评论:0      收藏:0      [点我收藏+]
    private void share(String content, Uri uri){
        Intent shareIntent = new Intent(Intent.ACTION_SEND); 
        if(uri!=null){
            shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
            shareIntent.setType("image/*"); 
            //当用户选择短信时使用sms_body取得文字
            shareIntent.putExtra("sms_body", content);
        }else{
            shareIntent.setType("text/plain"); 
        }
        shareIntent.putExtra(Intent.EXTRA_TEXT, content);
        //自定义选择框的标题
        //startActivity(Intent.createChooser(shareIntent, "邀请好友"));
        //系统默认标题
        startActivity(shareIntent);
    }

使用android自带分享功能进行分享。

转载自:http://blog.csdn.net/spare_h/article/details/7236758#

完美实现同时分享图片和文字(Intent.ACTION_SEND)

原文:http://www.cnblogs.com/shoneworn/p/4892022.html

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