zoukankan      html  css  js  c++  java
  • 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();
            }
    
    
        }
  • 相关阅读:
    Redis之主从复制原理
    字符编码
    Android studio报错 "No IDEA annotations attached to the JDK 1.8, some issues will not be found" 解决方法
    json
    ajax
    《人月神话》读后感(三)
    Jquery基础
    EL表达式
    Android Studio更改虚拟机位置
    Mybatis之mybatis的介绍
  • 原文地址:https://www.cnblogs.com/819158327fan/p/11943404.html
Copyright © 2011-2022 走看看