如何从Android上的电子邮件选择器中删除的Facebook,Skype和不必要的选项 [英] How to remove facebook,skype and Unnecessary option from email chooser on android

查看:100
本文介绍了如何从Android上的电子邮件选择器中删除的Facebook,Skype和不必要的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我在email.while发送WAV文件作为附件显示电子邮件选配器Indent.createChooser意图将列出电子邮件时,Gmail,Facebook的,SKYPE,蓝牙和其他不必要的选项了。我想只显示电子邮件和Gmail选项。我不知道该怎么做?
你以前可能是其重复的问题,我看到了下面的链接,它并不能帮助我。

In my app i am sending WAV file as attachment in email.while showing the email chooser the Indent.createChooser intent will list the email,gmail,facebook,skype,bluetooth and other unnecessary option it. i want to show only the Email and Gmail option. i do not know how to do that? Before you its possibly duplicate question i saw the following link and its does not help me.


  1. 如何在邮件发送记录的声音吗?

  2. Android意向选择器,只显示电子邮件选项

  1. How to send recorded voice in email?
  2. Android Intent Chooser to only show E-mail option

至于说在上面的链接我曾尝试 sendIntent.setType(音频/ RFC822); 。这又是显示相同的。

As told in the above links i have tried sendIntent.setType("audio/rfc822");. Again it is display the same.

我的code样品:<​​/ P>

my code sample:

    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
    sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://" + f.getAbsolutePath())); 
    sendIntent.setType("audio/wav");
    startActivity(Intent.createChooser(sendIntent, "Email file"));

更新问题:

我实现了一个样本有列出已安装的应用程序,然后单击列表视图我将推出的Gmail /电子邮件应用程序项目: 则说,没有应用程序可以执行此操作

i have implemented a sample with listing installed app and click item on the list view i will launch the Gmail / Email app: it is says "No Application can perform this operation".

要列出的应用程序列表视图:

To list the app in the list view:

-----------------
List<PackageInfo> packs = packageManager.getInstalledPackages(0);
  for(int i = 0; i < packs.size(); i++) {
     PackageInfo p = packs.get(i);
     ApplicationInfo a = p.applicationInfo;
     if ((includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
        continue;
     }
     App app = new App();
     app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
     app.setPackageName(p.packageName);
     app.setVersionName(p.versionName);
     app.setVersionCode(p.versionCode);
     app.setInstallDir(p.applicationInfo.sourceDir);
     app.setInstallSize(calculateSize(app.getInstallDir()));
     CharSequence description = p.applicationInfo.loadDescription(packageManager);
     app.setDescription(description != null ? description.toString() : "");
     apps.add(app);
     -----------

和在onclick项事件是:

and in the onclick item event is:

                Intent sendIntent = new Intent(getPackageManager().getLaunchIntentForPackage(app.getPackageName()));
                sendIntent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
                sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://" + Environment.getExternalStorageDirectory().getPath()+"/Music/SalsaFav.mp3")); 
                sendIntent.setType("audio/wav");
                startActivity(Intent.createChooser(sendIntent, "Email file"));

请帮我。

推荐答案

您有两种选择:


  • 使用<一个href=\"http://developer.android.com/reference/android/content/pm/PackageManager.html#queryIntentActivities%28android.content.Intent,%20int%29\"相对=nofollow>软件包管理系统,提供queryIntentActivities功能,过滤器从并显示你自己的对话框

  • Use the PackageManager with queryIntentActivities function, filter from that and display you own Dialog

在这里,你会得到这实际上可以处理你的意图的应用程序:

Here you get the applications which can actually handle your Intent :

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://" + f.getAbsolutePath())); 
sendIntent.setType("audio/wav");

// Get the Activities which can handle the Intent
List<ResolveInfo> resolveInfos = getPackageManager().queryIntentActivities(sendIntent, 0);

// Loop on your Activities, filter and construct your own list here
if (!resolveInfos.isEmpty()){
  for (ResolveInfo resolveInfo : resolveInfos) {
  // Filter here !

  }
}


  • 查询自己与已知的包名与列表<一的软件包管理系统href=\"http://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationInfo%28java.lang.String,%20int%29\"相对=nofollow> getApplicationInfo 并建立你的对话框根据现有的应用程序

    • Query yourself the PackageManager with a list of known package name with getApplicationInfo and build you Dialog according to the existing applications
    • 我认为第一个解决方案最配衬您的需求。

      I think the first solution best matchs your needs

      这篇关于如何从Android上的电子邮件选择器中删除的Facebook,Skype和不必要的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆