Faster way to display Jsoup Elements on Android - android

Is there a faster way to display Jsoup elements onto android apps?
The app I am working on download and parses a page using jsoup, gets a section of the page I want to display, edit some parts of it, then converts that section's element to HTML and displays it onto a webview.
Is there a faster way to do this? I noticed that getting the HTML from the elements takes a long time. Is there a way to directly add the element onto webview or something else without having to acquire its HTML?

Unfortunately, what you're experiencing is a side effect of trying to do (relatively) complex processing on a mobile device. Keep in mind that your app may be installed on low-resource devices and stuff like this screams low ratings.
Having said that, you usually want to do these sort of complex transformations on the server side, and then send the (formatted) data to the device - which you can then render in your WebView, for example. There is no inherent way to make jsoup faster - you're only limited by the resources of your device (as you already found out).

Related

how to create book app in android?

I am writing an learning app that consists of many pages included text and pictures as well and some highlighted code (say C++) for learning.
I decided to implement this by html WebView but there is some disadvantages:
1.Sometimes webview gets blank (i don't know why!!) and this makes bad user experience
2.Rendering time for webview is very slow as opposed to native widgets like textview & imageview etc. and some times it takes 1 second to load the contents.
and some advantages as well :
1.Styling is very easy in html using css specially for code highlighting in my case
approach:I saved them in my asset folder and load them with loadurl() method up to webview.
Is there a better way to create book-like app in android ?
How can I reach better performance ? In addition consider styling matters.

Rendering (display) a part of a web page in an android application

This question is not for android programmers only , but also for whom interested in web pages design .
I would like to make an android app that renders some parts of specific web pages only (not all part of them) .
I am heard about jsoun library as a tool that does this task
My main problem is:-
How I can choose the correct link from web page's source that render some part of a web page ?.
For example let us take the famous website FORBES
How can I render the list of richest men by their name and Rank,Name net Worth,Change,Age,Source,Country of Citizenship as they appearthere excluding other parts of web page.
Here is a good example of an application that accomplishes like this task
You may have a good suggestion.
You need to screen-scrape the HTML. I'm not sure about any Android libraries for doing this, but I would build a RESTful service to return the data I needed. The service would than do the heavy lifting of scraping the webpage and converting the data to JSON to be sent back to device.
On the server side I would use a library like Beautiful Soup to do the scraping. It is easy enough to use once have it installed. You create a beautifulSoup object from the HTML and make calls like myObject.getTitle() to return the title of the HTML. You can use the tags in the HTML to drill down to the elements you want and build up a JSON object from there. Here is an image of the elements you are interested in for that list. Note the #ids on the right for that list item.
http://i.imgur.com/TMjhYvY.jpg

Why use ImageView when we have WebView?

This might seem to you guys as a stupid question, but it comes into my mind so many times:
Why is there an ImageView in Android? We have a WebView, which is capable of displaying images, and so much more stuff. So why would you provide an ImageView as well? Maybe there is some fundamental reason for this, but I just don't see it. Whenever I want to use some media, I try to use a WebView, because this allows me to change the type of media if I wish to do so, and I do not need another Type of View.
So to not make this question to broad, let's bring it down to this:
In which scenario does an ImageView have big advantages over a WebView?
EDIT
And a second question:
If I have some audio, some html-text and some pictures, which are stored locally on my device, would I use one WebView to display them, or would I use one Type of View for each Type of media?
WebView is a much more expensive widget to use, in terms of memory consumption, than is ImageView.
The reason for the memory cost of WebView is the fact that WebView is powered by a fairly complete copy of WebKit. WebKit is an open source Web rendering engine that forms the heart of major Web browsers, such as Chrome and Safari. While the version of WebKit that lives in Android is one optimized for mobile use, it still represents a fairly substantial code base, and rendering complex Web pages takes up a fair amount of RAM (as anyone with lots of browser tabs on their desktop knows all too well).
FACT: The WebView implementation is such that it will consume more memory if used to download & display images. Always. Also, ImageView has special methods / XML tags for cropping, resizing, scaling & manipulating images (which WebView doesn`t).
A person has a image in the gallery. The persom wants to show it inside the app. What will it do?
Go and host it on an online image hosting website and then pass the url to the WebView?
That ain't a cool Idea.. and people and Google understand that.
Basically image view using for showing image from gallery , drawable or url.Webview for handling or showing web content or html kind of thing.
Well ImageView consumes less memory. ImageView can change the image display options.
ImageView can display images from different sources like "Resources, drawables".
WebView mainly for displaying html pages.

Rendering large images in WebView

I'm a newcomer in development of android apps. But, I'm undertaking what feels like a large project and I'm looking for information on whether it will work or not, before I get to far in.
As I've read, when trying to display very large images in android, it is most useful to use the "webview".
So, I took that advice, split my image into 1024 smaller images, and laid them out in an html table (not quite finished yet). Now, I'm noticing as the table gets larger my phone begins to lag upon scrolling.
My question is, is webview trying to render every single picture at once upon loading? If so, is there a way to make webview only render a set of images at one time? Let's say I'm at 14,000X x 24,000Y on the image, can I set webview to render the next 5,000px in each direction only, or is this necessary at all?
I can't seem to find the information I'm looking for, but will continue to search. Otherwise, any and all help is appreciated. Thanks!
i have exactly same problem and i found use full this library:
https://github.com/nostra13/Android-Universal-Image-Loader
you can configure a lot of parameters and using cache..

Produce thumbnail from pdf on Android

I am managing a bunch of PDF files in an android application maintaining a list of records in a SQLite database as well as storing the pdf files on the external storage.
Now I would like to present a thumbnail of the first page of the pdf in my list view as part of each cell representing a pdf.
I am aware of libraries like iText, fop.. on the JavaSE side that can render a PDF but I would rather not delve into embedding a large library like that. On a similar approach I would also rather not embed a native PDF viewer like droidreader, apv or vudroid.
Otherwise I could of course also get it rendered on a server via some webservice but that is a lot of headache as well.
I am already using intents to get the pdf's displayed for the user so I was thinking it would be great if I could get a thumbnail via a intent call as a result somehow. However I found nothing on the web (e.g. on openintents) that indicates something like that exists ..
So I am a bit at a loss on what to do? What do you think is the best approach to get these thumbnails into my app? Are there any public intents available? Or did I just totally miss something and the SDK provides features for that already (it should imho but currently does not)?
You are going to get a lot faster resopnse rasterizing the PDFs on the server and there are lots of libraries to do this in C, Java, Php.

Categories

Resources