不接sdk分享到微信,微博等第三方

来源:互联网 发布:js怎么为radio赋值 编辑:程序博客网 时间:2024/06/05 19:58

发图到朋友圈,微信

Intent intent = new Intent();ComponentName comp = new ComponentName("com.tencent.mm",        "com.tencent.mm.ui.tools.ShareImgUI");//ShareToTimeLineUIintent.setComponent(comp);intent.setAction("android.intent.action.SEND");intent.setType("image/*");intent.putExtra(Intent.EXTRA_TEXT, "it's text~~");intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/已修改/undefined3dd3.jpg")));startActivity(intent);

多图到朋友圈

                intent.setAction(Intent.ACTION_SEND_MULTIPLE);                intent.setType("image/*");                ArrayList<Uri> imageUris = new ArrayList<Uri>();                for (File f : files) {                    imageUris.add(Uri.fromFile(f));                }

图文到新浪微博

                ComponentName comp = new ComponentName("com.sina.weibo", "com.sina.weibo.EditActivity");                Intent intent = new Intent(Intent.ACTION_SEND);                intent.setType("image/*");                intent.putExtra(Intent.EXTRA_TEXT, "it's text~~ http://www.baidu.com");                intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/undefined3dd3.jpg")));                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                intent.setComponent(comp);                startActivity(intent);