Parsing Jsoup List
Solution 1:
First of all, you might consider only using English when you write a program. This especially includes naming comments and variables, classes, functions etc. You never know if eventually someone who doesn't speak your language has to read your code (e.g. when you post it on SO). Second of all, I'm unsure as to what part in your code you're refering to; there are two different methods in which HTML is being parsed.
Anyway, I assume you're refering to doInBackground()
from class Logo
. You basically already achieved exactly what you're looking for in the ParsingPaginaWeb
class. You loop over each found <img>
and fetch the respective image:
for(Element img : document.select("div.news-col-0 img[src]")) {
String src = img.attr("src");
InputStream is = new java.net.URL(src).openStream();
Bitmap bitmap = BitmapFactory.decodeStream(is);
/* save the bitmap or pass it somewhere else,
otherwise, it will simply be overwritten */
}
You are probably going to have to change the data types in which you store the bitmaps, since you're retrieving more than one. You could use a List<Bitmap>
to store them for example.
Post a Comment for "Parsing Jsoup List"