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     }

更多相关文章

  1. Android(安卓)mdpi ldpi hdpi区别(转)
  2. Android(安卓)实现ListView异步加载图片
  3. FFmpeg学习—android 编译libfaac 音频库
  4. Androd学习笔记—— Android刷新本地相册
  5. android Error: unterminated entity ref 问题
  6. ubuntu16.04 Android(安卓)Studio 模拟器无法启动
  7. Android新浪微博开发(四)主UI的完善
  8. Anroid图片格式转换程序(winXP+cygwin+opencv+ndk)
  9. Android调用手机新浪微博客户端分享

随机推荐

  1. 深度详解Retrofit2使用(二)实践
  2. Android binder 实例
  3. android 的几个黄色警告解决办法
  4. 判断可用的intent和更改Drawable的透明度
  5. Unity上同时兼容Android和IOS的JSON库
  6. android 加载 网络图片
  7. Android实现“退出确认”对话框
  8. android 怎么判断手机号是移动还是联通
  9. 关于android中drawable—hdpi、drawable
  10. 检查Android进程当前是否正在后台运行