Lio*_*luz 1 android android-intent android-browser
我知道如何使用Intents打开URL:
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.lala.com"));
startActivity(browserIntent);
Run Code Online (Sandbox Code Playgroud)
但是如何在新窗口/选项卡上打开多个URL?
尝试创建几个Intent并使用不同的startActivity打开每个Intent但它只打开列表中的最后一个;
code code code
startActivity(Intent1); startActivity(Intent2); startActivity(Intent3); -> only Intent3 is opened eventually (which of course make sense :)).
Run Code Online (Sandbox Code Playgroud)
感谢任何帮助!
更新:仍在寻找答案:/
我想出了一个可能的解决方案,它确实在一个新窗口中打开了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);
Run Code Online (Sandbox Code Playgroud)
以某种方式启动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);
Run Code Online (Sandbox Code Playgroud)
无论如何以某种方式启动活动一次打开几个URL?用setResult()和startActivityForResult()的东西可能吗?
| 归档时间: |
|
| 查看次数: |
6789 次 |
| 最近记录: |