Android 浏览器 : open several URLs, 每个在新窗口/选项卡上(以编程方式)

标签 android android-intent android-browser

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

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

但是我如何打开多个 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);

BrowserBookmarksPage.java

有什么方法可以启动 Activity 来一次打开多个 URL?也许有 setResult() 和 startActivityForResult()?

最佳答案

我想出了一个可能的解决方案,它确实会在新窗口中打开 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);

关于Android 浏览器 : open several URLs, 每个在新窗口/选项卡上(以编程方式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4119084/

相关文章:

android - Parcelable 写入可序列化对象时遇到 IOException

javascript - Assets 和 node_modules (Phonegap/Cordova)

java - 在 Android 中每 10 分钟调用一个方法

android - 如何创建主屏幕快捷方式以恢复热门 Activity

android - WebView 链接点击打开默认浏览器

java - 从第二个 Activity 传输数据时出错

android - ImageButton 在 gridlayout 中自动调整大小

java - 初学者 Android : ListView to affect the next class

css - 位置 : fixed menu not working in Android 4+

javascript - Android浏览器-本地主机通信(手机微型网络服务器)