In my application am showing contents with URL www.domain_name.com/content?id=5513 . Each content have different ids. When phone have data then it loads WebView from network, otherwise it loads from cache. My issue is that webview loads partially for every URL.
It was backend issue, where pages are loading dynamically to single page. Changed dynamic page to single page.
Related
My application consists of tablayout with webview in each tab. There are two ways of loading offline content one is loading local pages & the other is caching. I am currently using caching , however which is faster ? Is loading local pages obsolete or redundant ?
For example when the webpage loading is complete I want to save it in
when I swipe from one tab to the other , no matter what I do the webpage will reload. I just want it to be blistering click just like viewing photos in a photo gallery.I tried almost everything and finally want to check loading local pages i.e when the user will navigate to different pages a local page will load.
Will it make any difference ?
I am currently working on android webview applications. I was wondering if there is a way to load selected pages only in android webview, like just tell the app to load only specific pages,not whole website. Is it possible?
Depends on what you mean by specific pages. You can lock the webview into only a set of URLs by overriding shouldOverrideUrlLoading to return true and just not load any URLs you don't want to. If you mean you want to not load part of a URL I don't think there's a way to do that.
I have a scenario where on a page I can have multiple WebViews that can dynamically load, all at the same time. For example the user may have defined a Google and Yahoo link on the same page. All fine and dandy. What I need though is a way to show that a web view is being loaded without the standard Loading progress dialog since that will freeze the screen. Rather I would like to either show an image in the web view itself saying the web view is loading or have an indicator INSIDE the webview that does not affect the users ability to add data in case the loading of the multiple web views takes a while.
I attempted to load an image in the web view(s) just before loading the real urls, but it seems to either be ignored or immediately overwritten.
thanks!
I am working on an android app that displays Web Content that it obtains from a Web site. The app obtains this content from a Web page. The problem is I want to display a particular portion of the Web page, not the whole thing as the whole thing contains excess unwanted content. How can I display the data I need?
you need to download HTML code without WebView first. Then process it removing unwanted data, and then load resulting HTML into WebView
I'm trying to load a url in webview in android. The url loads fine in the web view. But the problem is the loading time of the webpage in the webview. Sometimes the webpages loads instantly within 1-2 seconds. But sometimes, the web page takes more than 40 seconds to load the webpage in the web view. When I checked the url on the browser, it loads within or less than 2 seconds. The problem is that when the web page takes more than 2 seconds, the white color of the webview is only showing and the users are thinking that the app is stuck or not responding. So they are complaining about the loading time. Is there any way to rectify this problem.
The best way to load content coming from internet is to use separate processes than the main one.
An example is:
you click to open the webview;
the app doesn't launch the webview activity but a splash screen with the "Loading..." information (plus a logo or an icon);
this splashscreen activity verifies if the internet connection is
available; if so, the splash activity launch an AsyncTask which, in a
separate backgorund thread, download the necessary HTML page (or XML file, etc);
when the content is correctly downloaded, the splash activity calls
the Webview activity, giving the necessary data trough an Intent.
This way is commonly used to load internet content on apps; it allows the operator to don't see a freezed activity but a window which suggest that a process is on-going.
Please find here the official information regarding AsyncTask.
A classic example which uses the SplashScreen/AsyncTask/BackgroundProcess is a RSS Reader; please find here a source code which can help you to understand (check out the SplashScreenActivity).
This is one way to do it, but it's not the only one.
I had similar problem on Android 4.4 version. This worked for me
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
It is due to some bug in webview for Kitkat version.