启动Android浏览器

ran*_*vee 4 android

我需要有关如何通过代码启动Android浏览器的说明.谢谢 !

sys*_*out 7

如果你想要一个完全成熟的浏览器尝试:

   startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://Yoururl.com")));
Run Code Online (Sandbox Code Playgroud)

看看ACTION_VIEW Intent.

如果您只想使用WebView显示一些HTML尝试:

WebView webview = new WebView(this);
setContentView(webview);
webview.loadUrl("http://yoururl.org/");
Run Code Online (Sandbox Code Playgroud)


Lee*_*vis 5

我不确定你的意思.但是从我所看到的你要么想要一个WebView,要么能够使用Intent来使用浏览器本身.

查看Intent的文档.还有一篇博文,为您提供4种在Android中打开网页的方法.我想一个常用的方法是使用Intent.ACTION_VIEW

Uri uri = Uri.parse( "http://stackoverflow.com" );
startActivity(new Intent(Intent.ACTION_VIEW, uri));
Run Code Online (Sandbox Code Playgroud)

这是一篇解释此内容的博客文章