简体   繁体   中英

How can I load a webpage with Google chrome instead of WebView in Android?

I want to let the user to visit my website by click a button.

However, I want the app to open the google chrome or other external web browser to open the website instead of load the url with WebView.

How can I do that?

You can do it with an ACTION_VIEW Intent --

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

If you want to do it on a button click, you will need to put it in the onClick method of your onClickListener .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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