开发者

Why android webview is much slower than the native android browser?

开发者 https://www.devze.com 2023-03-26 15:59 出处:网络
In my application, i have some external urls to load, for which i am using a custom webview. but the performance of this webview is very very slow. If i open the same url in 开发者_如何学Pythonnative

In my application, i have some external urls to load, for which i am using a custom webview. but the performance of this webview is very very slow. If i open the same url in 开发者_如何学Pythonnative android browser, it works fine. but in the webview, it just takes a lot of time to load the page. Is there anyway that the performance of a webview can be enhanced in terms of loading a webpage time? Help is always appreciated.


Usama, WebViews will be little slower than the browser as here every activity has to have a callback to the Android app layer.

Having said that, see if you can disable javascript (if it's not used in your app) and more importantly check the caching behavior in the webview that has been set. WebSettings has some methods related to caching like - setAppCacheEnabled, setAppCacheMaxSize, setCacheMode etc.

setDatabaseEnabled, javascrpt, loadImagesAutomatically are other properties that might impact the load time.

0

精彩评论

暂无评论...
验证码 换一张
取 消