Android 浏览器:打开多个 URL,每个 URL 都在新窗口/选项卡上(以编程方式)
我知道如何使用 Intents 打开 URL:
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.lala.com"));
startActivity(browserIntent);
但是如何打开多个 URL,每个 URL 都在新窗口/选项卡上???
尝试创建多个意图并使用不同的 startActivity 打开每个意图,但它只打开列表中的最后一个;
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);
有什么方法可以启动 Activity 来同时打开多个 URL? setResult() & 的东西也许是 startActivityForResult() ?
I know how to open a URL using Intents:
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.lala.com"));
startActivity(browserIntent);
But how can I open multiple URLs, each on new window/tab???
Tried creating several Intents and opened each with different startActivity but it just opens the last one on the list;
code code code
startActivity(Intent1); startActivity(Intent2); startActivity(Intent3); -> only Intent3 is opened eventually (which of course make sense :)).
Appreciate any help!
UPDATE: still looking for an answer :/
I've come up with a possible solution, which indeed opens the URL in a new window.
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);
Any way of somehow start the Activity to open several URLs at once? something with setResult() & startActivityForResult() maybe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想出了一个可能的解决方案,它确实在新窗口中打开 URL。
I've come up with a possible solution, which indeed opens the URL in a new window.
根据 此< /a>
因此,要回答您的问题,请在 2
startActivity
之间设置一个小延迟。According to this
So to answer your question, put a small delay in between 2
startActivity
.