// 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)));
新聞熱點
疑難解答