// ComponentName(组件名称)是用来打开其他应用程序中的Activity或服务的 Intent intent = new Intent(); ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");// 包名该有activity intent.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)));
Android APP中跳转至微信,分享图文给好友或者朋友圈(加跳转QQ好友或QQ群)
最新推荐文章于 2024-04-10 04:16:59 发布