-1

In Android, I want to get value from src attribute from image tag as follow.

<img border="0" height="430" src="http://2.bp.blogspot.com/-551kBiFcc3o/US2MxmAHq1I/AAAAAAAAZvM/DjurUt5-4Ac/s640/856738_537952452911181_897510449_o.jpg" width="640">
Raul Rene
  • 10,014
  • 9
  • 53
  • 75
PPShein
  • 13,309
  • 42
  • 142
  • 227
  • you can search for src= in the link and after that take the whole string until the next " . that should do the trick. – hardartcore Feb 27 '13 at 14:44
  • possible duplicate of [Parsing Html in java?](http://stackoverflow.com/questions/9664778/parsing-html-in-java) – CommonsWare Feb 27 '13 at 14:44
  • Also see http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – CommonsWare Feb 27 '13 at 14:45

1 Answers1

1

You can try using regular expressions to filter out img src's:

String imgRegex = "<img[^>]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";

You should use this only if you know what you're doing (as CommonsWare noted in the comments)

The rest is up to you - you've given us a little information about the context.

Community
  • 1
  • 1
Tool
  • 12,126
  • 15
  • 70
  • 120