如何在Android中调用浏览器打开网页

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在Android中调用浏览器打开网页相关的知识,希望对你有一定的参考价值。

参考技术A //默认浏览器
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri url = Uri.parse("填网址");
intent.setData(url);
startActivity(intent);

//其他浏览器

Intent intent = new Intent();
  intent.setAction("android.intent.action.VIEW");
  Uri url = Uri.parse("填网址");
  intent.setData(url);
  intent.setClassName("com.android.browser","com.android.browser.BrowserActivity"); startActivity(intent);
/**

其他浏览器的包名
uc:"com.uc.browser", "com.uc.browser.ActivityUpdate“
  opera:"com.opera.mini.android", "com.opera.mini.android.Browser"
  qq:"com.tencent.mtt", "com.tencent.mtt.MainActivity"
*/

VB 如何调用系统默认程序打开指定网页?

vb 如何调用系统默认的浏览器打开指定网页,类似于hao123的桌面版,单击图标后什么也不提示,直接用系统默认的浏览器去打开设置好的网址地址。

如果有工程源代码,修改后网站编译就能用,那是最好的。如果有的希望分享一下,nl745200@163.com,先谢啦

参考技术A 首先你得找到浏览器的路径。然后在vb中使用如下代码,例如用猎豹浏览器打开指定网页:

Private Sub Command1_Click()
Shell "F:\Program Files\liebao\LBBrowser\liebao.exe 网页绝对地址"
End Sub

路径和地址之间有一空格。
参考技术B Shell "C:\Windows\explorer.exe http://zhidao.baidu.com"
这里用了Windows自带的运行程序(就是Windows徽标键+R出现的那个程序),在这个程序里面输入网址(URL)可以自动用默认浏览器来打开。
参考技术C Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
ShellExecute 0, "open", "http://zhidao.baidu.com", 0, 0, 1
End Sub本回答被提问者和网友采纳

以上是关于如何在Android中调用浏览器打开网页的主要内容,如果未能解决你的问题,请参考以下文章

调用Android自带浏览器打开网页

android 如何调用默认浏览器(webservice)打开网页使用post的方式传递参数。

ANDROID如何调用系统软件打开文件

android手机怎么才能直接打开URL链接文件

APICloud中如何调用浏览器打开一个网页?

VB 如何调用系统默认程序打开指定网页?