欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

Android 分享文本或图片,,For sharing

来源: javaer 分享于  点击 578 次 点评:272

Android 分享文本或图片,,For sharing


For sharing an image, like in the example picture, it would be something like this:Intent share = new Intent(Intent.ACTION_SEND);share.setType("image/jpeg");share.putExtra(Intent.EXTRA_STREAM,  Uri.parse("file:///sdcard/DCIM/Camera/myPic.jpg"));startActivity(Intent.createChooser(share, "Share Image"));For text you would use something like:Intent share = new Intent(Intent.ACTION_SEND);share.setType("text/plain");share.putExtra(Intent.EXTRA_TEXT, "I'm being sent!!");startActivity(Intent.createChooser(share, "Share Text"));
相关栏目:

用户点评