如何加载像Chrome或Firefox Android中特定的浏览器在网络浏览应用 [英] How to load the application in Web-View in a specific browser like Chrome or Firefox in Android

查看:118
本文介绍了如何加载像Chrome或Firefox Android中特定的浏览器在网络浏览应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid,我在做一个应用程序,我需要在网络观片装入现有的应用程序。在平板时,我通过使用Web-查看我的应用程序是越来越加载默认的浏览器载入我的申请。

我怎么能加载一个特定的浏览器[喜欢Chrome或Firefox在网络上查看我的平板电脑的应用程序?


解决方案

  

在当我通过网络查看我的应用程序越来越加载默认的浏览器载入我的应用程序的平板。


的WebView 是您在活动之一的UI放置一个小部件。它不是默认的浏览器。

如果您正在呼叫使用loadURL()的WebView ,它带来了默认浏览器,这是因为Web服务器发出一个重定向。您可以添加 WebViewClient 来您的应用程序来处理这一点,因为在这里讨论: http://stackoverflow.com/a/8941605/115145


  

我怎么能加载一个特定的浏览器[喜欢Chrome或Firefox在网络上查看我的平板电脑的应用程序?


如果你确实想将内容加载到Web浏览器,你让的用户的选择什么样的浏览器中的用户的意愿使用。通常情况下,当你推出一个网址(例如,通过 startActivity()上的 ACTION_VIEW <$ C,这将自动发生$ C>意图) - 如果有一个以上的浏览器,他们也没有设置一个默认的,用户将有选择器来选择他们希望使用的浏览器psented $ p $。

I am new to Android, i am doing an application where i need to load our existing application in Web-View on Tablet. In the Tablet when i load my application by using Web-View my application is getting loaded in default browser.

How can i load my application in a specific browser[like Chrome or Firefox] in Web-View on Tablet?

解决方案

In the Tablet when i load my application by using Web-View my application is getting loaded in default browser.

WebView is a widget that you place in the UI of one of your activities. It is not the default browser.

If you are calling loadUrl() on the WebView, and it is bringing up the default browser, that is because the Web server is issuing a redirect. You can add a WebViewClient to your app to handle this, as is discussed here: http://stackoverflow.com/a/8941605/115145

How can i load my application in a specific browser[like Chrome or Firefox] in Web-View on Tablet?

If you really do want to load content into a Web browser, you let the user choose what browser the user wishes to use. Typically, this will happen automatically when you launch a URL (e.g., via startActivity() on an ACTION_VIEW Intent) -- if there is more than one browser, and they have not set a default, the user will be presented with a chooser to pick which browser they wish to use.

这篇关于如何加载像Chrome或Firefox Android中特定的浏览器在网络浏览应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆