Android 原生分享文字、图片代码

Intent share_intent = new Intent();

share_intent.setAction(Intent.ACTION_SEND);//设置分享行为
share_intent.setType("image/plain");//设置分享内容的类型
share_intent.putExtra(Intent.EXTRA_SUBJECT, "123");
share_intent.putExtra("android.intent.extra.TEXT",text);
share_intent.putExtra(Intent.EXTRA_STREAM, saveBitmap(finalBitmap,"img"));//添加分享内容
//创建分享的Dialog
share_intent = Intent.createChooser(share_intent, "分享到");
context.startActivity(share_intent);

带文字和图片(微博可以接收到文字和图片,微信和QQ只能接收文字或者图片) 。

同时分享文字和图片网址:https://www.jianshu.com/p/d1852ace3fd5 ;

发布了5 篇原创文章 · 获赞 1 · 访问量 452

猜你喜欢

转载自blog.csdn.net/weixin_42716507/article/details/100883003
今日推荐