【问题标题】:Android - open firefox intent url in new tabAndroid - 在新选项卡中打开 Firefox 意图 URL
【发布时间】:2014-06-03 18:56:33
【问题描述】:

我有一个带有几个按钮的视图,每个按钮都假设在 firefox 中打开不同的 url,但是在单击其中一个按钮并在 firefox 中打开 url 后,所有其他按钮只是打开 firefox 但不导航到它们的 url .

这是我用于意图的代码:

Intent i = new Intent("android.intent.action.MAIN");
i.setComponent(new ComponentName("org.mozilla.firefox", "org.mozilla.firefox.App"));
Bundle b = new Bundle();
b.putBoolean("new_window", true); //suppose to set the new window
i.putExtras(b);
i.addCategory("android.intent.category.LAUNCHER");
i.setData(Uri.parse(url)); 
startActivity(i);

我应该如何编写代码来打开每个按钮点击新标签。

【问题讨论】:

    标签: java android firefox android-intent


    【解决方案1】:

    使用Intent.ACTION_VIEW

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    // ...
    

    【讨论】:

      【解决方案2】:
      openpage.setOnClickListener(new View.OnClickListener() {
      
                  @Override
                  public void onClick(View v) {
      
                       startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("your url")));
      
                  }
              });
      

      应该有效

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-05-03
        • 1970-01-01
        • 2012-04-14
        • 2020-06-04
        • 1970-01-01
        • 2014-01-10
        • 1970-01-01
        相关资源
        最近更新 更多