首页 > 系统 > Android > 正文

Android APP中跳转至微信,分享图文给好友或者朋友圈(加跳转QQ好友或QQ群)

2019-11-09 17:59: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<Uri> 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)));


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表