String contentDetails = "朋友快来玩 ***游戏把"; Intent intent = new Intent(Intent.ACTION_SEND); // 启动分享发送的属性 intent.setType("text/plain"); intent.setType("image/*"); //分享图片信息类型 List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(intent, 0); if(!resInfo.isEmpty()){ List<Intent>targetedShareIntents = new ArrayList<Intent>(); for(ResolveInfo info :resInfo){ Intent targeted = new Intent(Intent.ACTION_SEND); intent.setType("image/*"); //分享图片信息类型 targeted.setType("text/plain"); ActivityInfo activityInfo = info.activityInfo; if(activityInfo.packageName.contains("bluetooth")|| activityInfo.name.contains("bluetooth")){ continue; //过滤蓝牙应用 } if(activityInfo.packageName.contains("com.my.activity")|| activityInfo.name.contains("com.my.activity")){ continue; //过滤自己的应用包 } if(activityInfo.packageName.contains("gm")|| activityInfo.name.contains("mail")){ targeted.putExtra(Intent.EXTRA_TEXT, contentDetails); }else if(activityInfo.packageName.contains("zxing")){ targeted.putExtra(Intent.EXTRA_TEXT, contentDetails); }else{ targeted.putExtra(Intent.EXTRA_TEXT, contentDetails); } targeted.setPackage(activityInfo.packageName); targetedShareIntents.add(targeted); } //分享框标题 Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0),"选择程序分享"); if(chooserIntent == null){ return; } chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{})); try{ startActivity(chooserIntent); }catch(android.content.ActivityNotFoundException ex){ Toast.makeText(Activity_AboutMe.this, "没找到分享的应用", Toast.LENGTH_SHORT).show(); } }