I just want to get the HTML String from my webview for that i am trying with the following code
webviewTxt.loadUrl("javascript:HTMLOUT.processHTML(document.documentElement.outerHTML);");
But i don't know how can i get this code to string. I even don't know whether this is true code to grab the HTML String or not.
In my webview i have following String
This is a test Demo
Where "test" is written in Italic and "Demo" is written in Bold So i want to get the HTML string from above code.
Above string is just an Example, The string may be anything not the same as above string each time.
If anyone is having any idea then please guide me, I already checked so many link links from SO and other google stuff but i am not able to grab the String in HTML from Webview.
Related
I'm setting up a TextView in my application that users type in a web address, and then a WebView loads it. All of this currently works, and I have it auto filling the TextView with the last used address.
I would like it to prompt the user to put in the address without the https:// by having https:// already there, bold and uneditable. I have seen this done before, but im not even sure how to start on it. any help would be appreciated.
I don't think there is a xml namespace for that, but you can put a TextViewin fron of the EditText and create an illusion like explained here
But the real magic happens when you are reading the EditText which means you put the http:// in front of it.
For example like this
String url = textView.getText().toString();
if (!url.startsWith("http")) {
url = "http://" + url;
}
I want to read web pages (not mine and specified) and replace some words with other words in the web page loaded.
For example, let's suppose that there is a webpage that shows string "Hello, World! 07-17-2015". And I want to replace all "07" with "08". Then this page will be shown like this: "Hello, World! 08-17-2015". (There is only a string in this example, but I want to execute at any page)
I want to do this with Android. Can I make an app with this feature?
Just make a request to get the HTML content of the page (bazillions methods to do it, lots and lots of libraries, or plain HttpURLConnection).
Then take that output as String and replace what you want:
// Your network implementation
String htmlContent = response.data.replaceAll("07", "08");
Then use a WebView and load this String inside it:
webView.loadData(htmlContent, "utf-8");
Having done some basic tutorials, I started making my first real android app in eclipse. I want this app to check if the text in an EditText matches the text on a PDFpage (this one: http://www.augustinianum.eu/roosterwijzigingen/14062012.pdf (it contains my school's schedule changes)). I've found out how to make the app check if the text in the EditText matches a string (with the method contains()), so now the only thing I need to do is to download all of the text of that PDFpage to a string. But I have no idea how to. Or is there maybe a method which I can check with if a PDFpage contains a certain word without downloading the entire website to a string?
Thank You!
A PDF is not a text-file, it is a binary file. Therefore you should not download the data into a string but into a byte array. Then you must extract the text data from the PDF using some PDF library. In that text you then can search your keyword.
The most interesting part will be to extract the text from the PDF. You may look around this site for other questions which tried the same. Here is a quick search or this.
I have a HTML String as By<!--[10018729]//--> <img src=\"http://images.thecarconnection.com/tny/avatar-image-for-ernst_100345731_0.jpg\" alt=\"Kurt Ernst\" width=\"20\" height=\"20\"/> Kurt Ernst, Contributor". I have to get data from the this string as the name as Kurt Ernst The Url as http://images.thecarconnection.com/tny/avatar-image-for-ernst_100345731_0.jpg. I don't know how to get it? Please suggest any solution regarding the same.
Thanks in advance.
I did this kind of parsing using my own logic. It has worked for me. You can get the String from the URL then use an if condition to get the title and src by writing a while or for loop. Break the loops when you get both the title and the src.
I'm new to Android programming.
I would like to know if I can load a certain part of a website into webview? The website is made from CSS. It contains headers and buttons that I do not want to be displayed into the webview. I would only like to display the contents in the website, like images and texts. Is this possible? If so, how?
Many thanks in advance!!!
You can use the public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl) method to load a customised html, maybe your app can get the html from the site, modify it, and loadDataWithBaseUrl then.