zoukankan      html  css  js  c++  java
  • Android 各种功能代码收集

    1.分享图片等文件到单个指定微信好友

     1 /**
     2      * 分享信息到朋友
     3      * 
     4      * @param file
     5      *    假如图片的路径为path,那么file = new File(path);
     6      */
     7     private void shareToFriend(File file) {
     8         Intent intent = new Intent();
     9         ComponentName componentName = new ComponentName("com.tencent.mm",
    10                 "com.tencent.mm.ui.tools.ShareImgUI");
    11         intent.setComponent(componentName);
    12         intent.setAction(Intent.ACTION_SEND);
    13         intent.setType("image/*");
    14         intent.putExtra(Intent.EXTRA_TEXT, "测试微信");
    15         intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
    16         startActivity(intent);
    17     }

    2.分享图片等文件到微信朋友圈

     1     /**
     2      * 分享信息到朋友圈
     3      * 
     4      * @param file
     5      *            ,假如图片的路径为path,那么file = new File(path);
     6      */
     7     private void shareToTimeLine(File file) {
     8         Intent intent = new Intent();
     9         ComponentName componentName = new ComponentName("com.tencent.mm",
    10                 "com.tencent.mm.ui.tools.ShareToTimeLineUI");
    11         intent.setComponent(componentName);
    12         intent.setAction(Intent.ACTION_SEND);
    13         intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
    14         intent.setType("image/*");
    15         startActivity(intent);
    16     }

     

  • 相关阅读:
    bisect in Python
    1385. 两个数组间的距离值
    面试题 04.08. 首个共同祖先
    Python关键字yield
    1237. 找出给定方程的正整数解
    响应式文字
    java环境变量设置
    小 div在大 div中左右上下居中
    清除浮动
    jQuery 图片等比缩放
  • 原文地址:https://www.cnblogs.com/_ymw/p/4140229.html
Copyright © 2011-2022 走看看