How to read all text and images from a html page for example
http://wireless.ign.com/articles/118/1186400p1.html
Lets say i would like to get the text on the page, and the Latest images?
How would i go about doing this?
via HTTPGET Request? If so how?
How can i get this text and then do something with it and the images, like set it to a text view, and set the images to ImageView.
use below code in unix/linux
wget http://wireless.ign.com/articles/118/1186400p1.html -O test.html
Use HttpURLConnection to get the html, and then use Regex or something like JSoup or similar to parse the Html.
Related
I would like knowing if it's possible to obtain the preview image (thumbnail) of any text file in Android, like PDF, DOC, TXT, PPT, PPTX, RSS or HTML.
If the response is positive, how do I can make it?
I have the preview images of video and image files, and I want to obtain the same result for text files.
Thanks for your attention, greetings.
This can be quite a problem since you need to handle every file type individually.
TXT, RSS and HTML are simple enough, you can just read them all like a text file and display the text on the screen (first X characters, for instance, either with a TextView or by manually drawing it in the onDraw method. However, if you want to render the HTML, look at this question.
PDF is another story, you need some sort of rendering endine for that, you might want to look at MuPDF.
RSS and HTML Can work the same way as a normal TXT file.
PPT, PPTX and DOC will also need a custom renderer, you might want to look at this question.
I'm using a WebView to display a formatted HTML text file with color and font size.
My problem is it keeps removing spaces form the text, like it will combine two words together. I think it is because it is trying to fit the text within the screen width. How do I fix this? Or is there a better way to display formatted text like this? (I need size, color, links, and some centered text
This question has been already asked but was not answered.
WebView removing spaces from text
I think you need load formatted local html file, so algorithm:
Parse you unformatted html data.
Format html data as you like, using .replace method
Load formatted data to your webview, like this: Load local html in WebView?
any idea to set imageview.toImage() as img src in html of a webview.
let suppose I have an imageview (having some image in it).okay imageview.toimage() is treated as an image object in titanium. now what i need is i want to set
webview.html='<html><img src="here i want to put obove imageview.toimage()"></html>';
I tried many way anyone have experience of it please guide me.
regards:ali
save it to a file and assigne the file's url path OR base64Encode the image and provide that as the value for the src parameter
you might try to convert the image into a base64 blob text and use it as css background image data :
background-image:url('data:image/png;base64,'+Ti.Utils.base64encode(imageview.toImage()).getText()+'\');
https://github.com/harism/android_page_curl
This is the link I have taken as a sample for doing curl effect on android but it is having image flip as i want html page to have that curl effect as we are doing on image. How to do that just give me the idea.
I also gone through http://code.google.com/p/android-page-curl/
same thing i want with html page instead of image , onclick i want html page in curl effect if it is possible.
Are you looking for something in the html page or the WebView itself ?
For the html page, you can use javascript, something like http://www.turnjs.com/
I don't know if it's possible to curl a WebView. I'd say no.
Here is why I want to do.
I have an html string extracted from a rss feed.
I want it to display nicely in a WebView embedded in my activity.
I can easily do it using the loadData() function, but the display isn't optimized for a small device : in another word I want to resize the html content not to exceed my view width.
So images, frames, tables need to be resized.
How can I do it ?
I thought I could use Google Wireless Transcoder service but it only works with urls
One option would be to use css, but it depends on the feed (each post might have different formatting / apply styles inline)
Use loadDataWithBaseURL(), with "file:///android_asset/" as the base url. Put a css file in your /project/assets folder. Inject the css file into the tag of your html.