2

我知道如何使用 Intents 打开 URL:

Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.lala.com"));
startActivity(browserIntent);

但是如何打开多个 URL,每个 URL 都在新窗口/标签上???

尝试创建几个 Intent 并使用不同的 startActivity 打开每个 Intent,但它只打开列表中的最后一个;

code code code
startActivity(Intent1); startActivity(Intent2); startActivity(Intent3); -> only Intent3 is opened eventually (which of course make sense :)).

感谢任何帮助!

更新:仍在寻找答案:/

我想出了一个可能的解决方案,它确实在新窗口中打开了 URL。

Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.go.com"));
Bundle b = new Bundle();
b.putBoolean("new_window", true); //sets new window
intent.putExtras(b);
startActivity(intent);

浏览器书签页面.java

任何方式以某种方式启动 Activity 以一次打开多个 URL?setResult() 和 startActivityForResult() 的东西可能吗?

4

2 回答 2

5

我想出了一个可能的解决方案,它确实在新窗口中打开了 URL。

Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.go.com"));
Bundle b = new Bundle();
b.putBoolean("new_window", true); //sets new window
intent.putExtras(b);
startActivity(intent);
于 2010-11-08T19:22:36.423 回答
3

据此_

第二个攻击向量利用了 Android 浏览器正确处理意图所需的时间间隔。如果在足够短的时间间隔内发送了两个意图,浏览器将在同一个选项卡中执行它们。第一个意图可以是打开目标域,第二个意图可以是执行流氓 javascript。

因此,要回答您的问题,请在 2 之间稍作延迟startActivity

于 2012-03-20T16:13:02.903 回答