Looking for ?

Translate

How To Extract image src from tag in android

 You might found your self having issues to get img URl with a better image quality while working on android project/App. it could be Rss Project or any other one. See the solution below on how to get the img URL from IMG TAG
SOLUTION
//gettingString html = "Html String";
String imgRegex = "<[iI][mM][gG][^>]+[sS][rR][cC]\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";

Pattern p = Pattern.compile(imgRegex);
Matcher m = p.matcher(html);

if (m.find()) {
String imgSrc = m.group(1);
    //Here am loading the image in webview using Picasso Library    Picasso.with(context).load(imgSrc).resize(1500,1200).into(ImageViewObject);
}

Comment and Share. I love you guys. 

SHARE THIS POST

About Wakabia

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment