Reputation: 161
<description>
div class="field field-type-filefield field-field-book-review-image">
<div class="field-items">
<div class="field-item odd">
<img class="imagefield imagefield-field_book_review_image" width="500" height="741" alt="" src="**http://sampada.net/files/good%20earth.JPG?1327387980**" /> &
</description>
Upvotes: 1
Views: 966
Reputation: 20885
You'd better use DOM than SAX. Simply iterate through all elements named "img" , get the "src" attribute, build a URL and fire an AsyncTask to download the stream.
Upvotes: 1
Reputation: 624
if you only want 1 pic i would use this:
static final String image_URL = "http://sampada.net/files/good%20earth.JPG?1327387980";
//in the oncreate
ImageView bmImage = (ImageView)findViewById(R.id.<<your image id from the xml>>);
BitmapFactory.Options bmOptions;
bmOptions = new BitmapFactory.Options();
bmOptions.inSampleSize = 1;
Bitmap bm = LoadImage(image_URL, bmOptions);
bmImage.setImageBitmap(bm);
//under the oncreate
private Bitmap LoadImage(String URL, BitmapFactory.Options options)
{
Bitmap bitmap = null;
InputStream in = null;
try {
in = OpenHttpConnection(URL);
bitmap = BitmapFactory.decodeStream(in, null, options);
in.close();
} catch (IOException e1) {
}
return bitmap;
}
private InputStream OpenHttpConnection(String strURL) throws IOException{
InputStream inputStream = null;
URL url = new URL(strURL);
URLConnection conn = url.openConnection();
try{
HttpURLConnection httpConn = (HttpURLConnection)conn;
httpConn.setRequestMethod("GET");
httpConn.connect();
if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
inputStream = httpConn.getInputStream();
}
}
catch (Exception ex)
{
}
return inputStream;
}
hope this helps you.
Upvotes: 0
Reputation: 7435
Try the following open source library:
http://htmlcleaner.sourceforge.net/
Following are some more HTML parser:
http://java-source.net/open-source/html-parsers
Upvotes: 0