How to open default browser

后端 未结 2 635
耶瑟儿~
耶瑟儿~ 2021-01-16 13:51

I want to make somethink like hyperlink. Right now, i created button, which opens new Activity with WebView. But i want to open a \"globally\" default web browser at specifi

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-16 14:27

    You can fire a global intent that will be picked up by the browser

    Uri uri = Uri.parse( "http://www.google.com" );
    startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
    

    Also make sure to add the web permission to your manifest

    
    

提交回复
热议问题