android - 在android中拨号时如何显示 Activity 选择器菜单?

标签 android android-activity skype

我试图在拨号时显示 Activity 选择器菜单。以下代码在发送电子邮件时对我有用(从真实手机,在模拟器中不起作用):

        /* Create the Intent */
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

    /* Fill it with Data */
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to@email.com"});
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");

    /* Send it off to the Activity-Chooser */
    this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

但是当我将代码更改为:

        Intent call = new Intent(android.content.Intent.ACTION_CALL);
    call.setData(Uri.parse("tel:" + phoneNo));
    this.startActivity(Intent.createChooser(call, "Hello there..."));

没有显示 Activity 选择器菜单,只是直接拨号。我还想在该菜单中列出 Skype。你有什么想法吗?

最佳答案

正如其他人在您的 previous questions 中的回答,您确实需要阅读 Intents and Filters .不过,我会给你一个快速的解释。 Intent 是 Android 应用程序可以注册处理的一种消息。如果未安装 Skype,则它将无法注册该 Intent,因此不会显示在该菜单中。如果它已安装 但仍未显示,则表示它未针对该 Intent 进行注册。我不知道 Android Skype 应用程序,但从 picture 来看你在另一个问题中链接,它似乎确实注册了那个 Intent 并且会在安装时显示。

关于android - 在android中拨号时如何显示 Activity 选择器菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6349119/

相关文章:

javascript - Microsoft JScript 运行时错误 : 'WScript' is undefined

android - 如果浏览器启动了我的 Activity,如何从 Activity 堆栈中删除浏览器?

python - 如何使用 python 登录我的 Skype 企业帐户?

android - 什么是 CoordinatorLayout?

java - "Transform variable into final one element array"。 RecyclerView 滚动监听器出现错误

java - ListView 和 ArrayAdapter 配置,android 应用程序

java - 如何将数据从 Activity 传递到 DialogFragment

mysql - 通过 Skype for Business 发送消息

android - 撤消git命令 - 在android studio中重置磁头(硬)

没有 Play 商店的 Android Google Play 服务