Android(安卓)APP中跳转至微信,分享图文给好友或者朋友圈(加跳转QQ好友或QQ群)
16lz
2021-01-25
// ComponentName(组件名称)是用来打开其他应用程序中的Activity或服务的Intent intent = new Intent();ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");// 包名该有activityintent.setAction(Intent.ACTION_MAIN);intent.addCategory(Intent.CATEGORY_LAUNCHER);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setComponent(cmp);startActivityForResult(intent, 0);//分享图文给好友或者朋友圈---参考http://www.eoeandroid.com/thread-288401-1-1.html?_dsign=23fd2fc1 支持分享多张图片+文字到朋友圈关于同时分享图片+文字的原理可以参考知乎上回答:http://www.zhihu.com/question/21288247
- /**
- * 分享图片给好友
- *
- * @param file
- */
- private void shareToFriend(File file) {
- Intent intent = new Intent();
- ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareImgUI");
- intent.setComponent(comp);
- intent.setAction(Intent.ACTION_SEND);
- intent.setType("image/*");
- intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
- startActivity(intent);
- }
- /**
- * 分享多图到朋友圈,多张图片加文字
- *
- * @param uris
- */
- private void shareToTimeLine(String title, ArrayList
uris) { - Intent intent = new Intent();
- ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI");
- intent.setComponent(comp);
- intent.setAction(Intent.ACTION_SEND_MULTIPLE);
- intent.setType("image/*");
- intent.putExtra("Kdescription", title);
- intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
- startActivity(intent);
- }
//跳转指定QQ好友或者QQ群聊天界面
//String url="mqqwpa://im/chat?chat_type=wpa&uin=5****1965";//跳转至QQ好友String url = "mqqwpa://im/chat?chat_type=group&uin=463028**3&version=1";//跳转至QQ群startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
更多相关文章
- android 图片转 圆形和圆角矩形
- android 图片的缩放,bitmap的用法
- android图片资源转换
- Android调用摄像头和相册
- android 获取视频和图片的缩略图
- Android.9图片讲解(二)
- Android开发20——单个监听器监听多个按钮点击事件
- 初学Android,使用ContentProvider管理多媒体(五十四)
- android:text文字添加阴影效果