【问题标题】:my activity not being called with action_view我的活动没有被 action_view 调用
【发布时间】:2014-03-06 08:54:20
【问题描述】:

我在应用程序 com.example.one 中创建了一个活动,该活动调用了应用程序 com.example.two 中的另一个活动。 在活动两个清单中,我声明了以下意图过滤器

  <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
            </intent-filter>

但是,使用操作调用此活动 - Intent.ACTION_VIEW 甚至使用 android.intent.action.VIEW 直接调用浏览器,而不是我放置的 Intent 选择器。

Intent ii=new Intent(Intent.ACTION_VIEW);
        ii.setData(Uri.parse("http://www.google.com"));
startActivity(Intent.createChooser(ii,"done"));

请更新为什么我没有获得浏览器和我的活动的意图选择器。 谢谢

【问题讨论】:

    标签: android


    【解决方案1】:

    您可能需要包含另一个带有意图过滤器的可浏览类别。 &lt;category android:name="android.intent.category.BROWSABLE" /&gt;

    【讨论】:

      【解决方案2】:

      清除浏览器默认设置,然后尝试调用您的 方法,它应该要求选择可用应用程序的操作, 仅此一次,永远,随你去吧。

      要清除,请转到设置 -> 应用程序 -> 浏览器 [Chrome、Firefox 或任何其他(如果已安装)] 比每个浏览器按“清除默认值”按钮。

      【讨论】:

      • 好的,试着像这样调用这个活动:- Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(i);
      • 我得到了解决方案。我首先运行活动二,然后将其安装在模拟器上,然后安装活动一。
      猜你喜欢
      • 1970-01-01
      • 2015-12-03
      • 1970-01-01
      • 2015-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-05
      • 1970-01-01
      相关资源
      最近更新 更多