Android-分享多图到微信好友


    /**
     * 微信分享(多图片)
     */
    private static void shareWeChatByImgList(String kDescription, List<File> img_path_list,
            ShareChannel shareChannel) {

        try {
            if (img_path_list == null || img_path_list.size() <= 0) {
                ToastUtils.showShort("分享失败");
                LogUtils.dTag(TAG, "分享:分享的图片地址列表为null");
                return;
            }

            // 构建文件 Uri 列表
            ArrayList<Uri> paths = new ArrayList<>();
            for (File file : img_path_list) {
                paths.add(Uri.fromFile(file));
            }

            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setAction(Intent.ACTION_SEND_MULTIPLE);
            intent.setType("image/*");
            ComponentName comp = null;
            switch (shareChannel) {
                case WXSceneTimeline:
                    comp = new ComponentName("com.tencent.mm",
                            "com.tencent.mm.ui.tools.ShareToTimeLineUI");
                    break;
               
                default:
                    comp = new ComponentName("com.tencent.mm",
                            "com.tencent.mm.ui.tools.ShareToTimeLineUI");
                    break;
            }

            intent.setComponent(comp);
            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, paths);

            ActivityUtils.startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM