android createChooser 过滤多余app
来源:互联网 发布:baby对赌协议知乎 编辑:程序博客网 时间:2024/06/05 21:29
比如说,想发送带有附件的邮件,然后打开邮件的客户端,结果弹出一大群的不相关的app,比如蓝牙啊,Skype啊。
直接上代码
Intent iEmail = new Intent(android.content.Intent.ACTION_SEND); iEmail.setType("message/rfc822"); try { List<ResolveInfo> resInfo = getActivity().getPackageManager().queryIntentActivities(iEmail, 0); if (!resInfo.isEmpty()) { List<Intent> targetedShareIntents = new ArrayList<Intent>(); for (ResolveInfo info : resInfo) { Intent targeted = getEmailIntent();//getEmailIntent()这里是自己需求intent ActivityInfo activityInfo = info.activityInfo; if (activityInfo.name.contains("mail")) { targeted.setPackage(activityInfo.packageName); targetedShareIntents.add(targeted); } } Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "report attached"); if (chooserIntent == null) { return; } // A Parcelable[] of Intent or LabeledIntent objects as set with // putExtra(String, Parcelable[]) of additional activities to place // a the front of the list of choices, when shown to the user with a // ACTION_CHOOSER. chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{})); startActivity(chooserIntent); } } catch (Exception e) { Log.e(LOG_TAG, "Unable to email logs " + e.toString()); }
0 0
- android createChooser 过滤多余app
- Android Intent.createChooser()
- Android Intent.createChooser() .
- Android------Intent.createChooser
- 【起航计划 021】2015 起航计划 Android APIDemo的魔鬼步伐 20 App->Intents createChooser
- android Intent.createChooser 应用选择器 !!!
- android Intent.createChooser 应用选择器
- android Intent.createChooser 应用选择器
- Android Intent.createChooser 应用选择器
- 过滤Android工程中多余的资源文件
- 过滤Android工程中多余的资源文件
- 过滤Android工程中多余的资源文件
- 过滤Android工程中多余的资源文件
- 过滤多余的空格
- Android 开发之:Intent.createChooser() 妙用
- Android createChooser方法源码简析
- Android 开发之:Intent.createChooser() 妙用
- Unity过滤多余的材质
- 查看服务器负载
- Centos 7 搭建 Zimbra 邮件服务器
- linux下通过yum安装svn及配置
- android remount system
- 数据库几天原则和几则数据算法
- android createChooser 过滤多余app
- 工作流引擎的设计与实现
- 百度UEditor编辑器setContent innerHtml 未定义报错。
- 13. Roman to Integer
- dijkstra 最短路径算法模板
- 嵌入式软件工程师和需要与硬件交互的Android app开发工程师工作中注意事项
- JavaScript Functions — In-Depth
- 对 oc 学习的 阶段反思
- linux磁盘分区一些细节