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
Related
Is there a way for me to edit the contents of the Webview or to crop out some parts of the content, i'm focusing on UI and would like to clean up the content for a project i am working on.
Also lets say I want to display content of the webView individually as well (multiple webviews within an activity) for aesthetic purposes, how would I go about doing that?
One technique I've used in the past is to request the page with an HttpURLConnection rather than the WebView. Then I parse and edit the HTML data and display it in the WebView using the loadData method. You could even use something like JSoup to parse the HTML. However, if you are depending on having the JavaScript run on the page, you may have a problem because using loadData will disrupt the same-origin policy.
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!
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.
I need to create an android browser in Yoruba language. I have already used webviews to create one in English language. What i wnt to do is to get the content of each page as it loads.
If i can get the whole content of a page into an array, i will be happy so i can now send the content to google translate api to translate to Yoruba and the some how i will replace the engliah in the html with the Yoruba strings.
I want to be able to do this on the fly before the page finish loading.
I have already developed an engliah browser and i know how to work with api. I just need to get the content of a webview page into an array and be able to replace after translation
Is there any way to make a call to the Android web browser, that ships with every phone, to render a web page and return it to my program as an image?
This would be hidden from the user. It would not command the Android browser to open itself up on the user's screen and display that web page. Instead, it would be feeding my program rendered web pages as images, and the user would only see my program and not the Android browser.
Thank you.
You don't need to use the system browser, the HTML rendering capabilities are available by the WebView class. It also has a method WebView.capturePicture(), which you can use to obtain an image of the whole rendered website.
However, it could be tricky to drive the WebView into rendering the web page while it is not visible. It must be attached as some view to the current Activity to start loading pages and render them, however its maybe possible to have it hidden in the background when attaching more than one view to a container view like ViewGroup.