how do i get the content of a webview - android

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

Related

I need to display only part of web page on android web view but I couldn't do with using Jsoup

I need display only specific part of web page on my webview and I tried it using Jsoup but selected part is display without java-script functionality and CSS styles. Jsoup display specified part but just only HTML elements and I can do nothing with it.
Can I do with zoom ? then how can I set initial zoom for specific area and I need to disable zoom option for users because if they adjust zoom then other part of web page will display.
How can I do this ?
You can do this by iFrame (HTML) , No neet to use Jsoup Also, Jsoup is exclusively made for data scraping.
Find out more here : link
Just make a html file in /assets folder in android studio and load that file in web view and you are done!

How to get predictions/autocompletion of URLs in a simple android browser?

I've created a simple android browser. I have used EditText for URL and Webview for loading webpages. Although the browser works fine when I put the complete URL path, I need a functionality by which I can get predictions/auto-completion of partially put URLs. Please let me know if following options are valid -
Using AutoCompleteTextView instead of EditText with a database of all the available websites on the internet(More than 1 billion websites!! Where can I get such dynamically updating database??)
Saving URLs which are frequently being used by the user and use them as a prediction in an AutoCompleteTextView.(How can I add these URLs in a dynamic AutoCompleteTextView/Database??)
Currently I am using google search as a workaround. Please provide your views on how this can be achieved.

How to edit content and layout of webview?

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.

Android Web View

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

How do you make a textview change according to an HTML document on the web

A couple of friends and I are setting up a little app business, and we are creating our general app for finding out all the latest news about our other apps. But we have a small problem.
We have a layout xml file with a table row in it. In the table row we want to show two textviews. One that says Current App version (Which we have done successfully) and the other one will show a few numbers from an HTML page which is live now.
I want to know, how would be able to get the text from the HTML document on the Web to that text view, or any other thing we could use.
(We know that the manifest will have to allow the internet)
Thanks
So in this TextView, you want to show the content of the HTML page? If this is the case, the best thing you could do is to replace the TextView with a WebView, where you could load the HTML page via its url.
If not this is the case, you can make a GET request to that HTML (i.e. using an Async Task), get the results and present them in the TextView.
Hope this helps!

Categories

Resources