Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 native 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.

like image 382
Usama Sarwar Avatar asked Aug 09 '11 05:08

Usama Sarwar


People also ask

Why is WebView slow?

As most of the heavy lifting done by WebView is loading images. In our Web-Pages we tend to use many images and most of those images are really large in size and loading them every time the user opens the App's WebView is not good.

What is the difference between WebView and native?

If we remove the engine part from the browser, we basically get a webview. When this engine is placed in a native app, we get a webview app. Basically, any app that loads content from a web page is a webview app. Use a mobile app builder for iOS and Android.

How does WebView differ from browser?

One of the most common uses for WebView is to display the contents within a link. Instead of launching a browser, switching the user from one app to another, and hoping for customer satisfaction, WebViews solve this problem by loading the contents of the link within the application.

Is Android WebView same as Chrome?

No, Chrome for Android is separate from WebView. They're both based on the same code, including a common JavaScript engine and rendering engine.


1 Answers

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.

like image 76
bschandramohan Avatar answered Sep 24 '22 06:09

bschandramohan