简体   繁体   中英

Android Image URL from HTML

I'm developing Android app. There is a json, which contains field "thumb". "thumb" is a string with html code.

"thumb":"<img width=\"1280\" height=\"570\" src=\"http:\/\/xxx.xxx.com\/wp-content\/uploads\/2014\/11\/profesor--kosmos.jpg\" class=\"attachment-medium-size wp-post-image\" alt=\"Hello World" \/>"

The question is how to extract image url from this string to obtain smth like this:

String url = "http:\/\/xxx.xxx.com\/wp-content\/uploads\/2014\/11\/profesor--kosmos.jpg"

Task is not to download image or display it. Just to obtain URL.

如果您正在使用phonegap,则可以编写以下jquery以获得URL:

var stringURL=$('img').attr('src');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM