简体   繁体   English

如何在 CustomTabs 中放置多个浏览器选项

[英]How to put multiple browser choices in a CustomTabs

I am looking without finding how to put several browser choices to open a link from my application in a CustomTabs我正在寻找但没有找到如何在 CustomTabs 中放置多个浏览器选项来打开我的应用程序中的链接

Here is my code这是我的代码

String url = "https://google.com/";

settingsPrivacyPolicy.setOnClickListener(view1 -> {
        CustomTabsIntent.Builder customIntent = new CustomTabsIntent.Builder();

        customIntent.setToolbarColor(ContextCompat.getColor(Main.this, R.color.toolbar_background));

        openCustomTab(Main.this, customIntent.build(), Uri.parse(url));
    });

public static void openCustomTab(Activity activity, CustomTabsIntent customTabsIntent, Uri uri) {

    customTabsIntent.intent.setPackage("com.android.chrome");

    customTabsIntent.launchUrl(activity, uri);

}

That it displays this and not Chrome by default(image below)它默认显示这个而不是 Chrome(下图)

我希望出现这样的东西

Can someone help me?有人能帮我吗?

Use the code bellow to choose.使用下面的代码进行选择。

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.stackoverflow.com"));

// Always use string resources for UI text. This says something like "Share this photo with"
String title = getResources().getText(R.string.chooser_title);
// Create and start the chooser
Intent chooser = Intent.createChooser(intent, title);
startActivity(chooser);

reference link参考链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM