0

I have a JSON data that I am successfully able to parse. I can fetch everything in my JSON and display properly.

Now I have a string in my JSON called Content. This is a large string and contains a lot of text. Just in the midst of the string can be an image URL. so something like this.

 "content":"<p>I&#8217;m interested in making MFA one of the best resources on the web for
    beginners &#8211; part of that is cultivating a welcoming environment, part of it is 
    attracting (and retaining) a large and diverse group of regular contributors, part of it 
    is developing a deep and broad set of resources, and part of it is encouraging newcomers 
    not only to nail down the basics<a href=\"http:\/\/bit.ly\/Ylloh8\.jpg

see the end of the above para. It has a jpg file. I need to parse that jpg as a image and load it as an image in my app. I am unsure how would I go about it ?

Spring Breaker
  • 8,233
  • 3
  • 36
  • 60
Sam
  • 350
  • 5
  • 18
  • Use regex for this purpose – Alex Salauyou Apr 14 '14 at 08:51
  • Could you redirect me to an appropriate link or an example perhaps ? – Sam Apr 14 '14 at 08:52
  • Check out this tutorial : http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/ –  Apr 14 '14 at 08:54
  • Hi This is a wordpress app. Unfortunately - it is not the only image. I already have a field called image which i can parse and display. The issue is that the content has an image inside it that needs to be parsed and displayed. The content is fetched as a string. – Sam Apr 14 '14 at 08:56
  • http://stackoverflow.com/questions/5120171/extract-links-from-a-web-page Jsoup also can be helpful. It is non-standard library, but still very useful for HTML parsing – Alex Salauyou Apr 14 '14 at 08:57
  • parse the webservice and save that image path as string. wherever you want to set to imgeview use image loader and set the image to that image view. just like XML parsing hope this will helps you – GvSharma Apr 14 '14 at 09:00

1 Answers1

0

If this is WordPress or other CMS app you are talking about, you can edit the RSS2 source files to include a separate tag with the URL of the image. If you don't have access to the source code, you need to use Regex.

contactsunny
  • 761
  • 7
  • 11
  • Hi This is a wordpress app. Unfortunately - it is not the only image. I already have a field called image which i can parse and display. The issue is if the content has an image inside it needs to be parsed. – Sam Apr 14 '14 at 08:55
  • @Sam you have the link of your image .. so you can download it ? –  Apr 14 '14 at 08:58
  • Hi Selmanon - i do have the image.I can parse it. But a field called content has some image link inside it. Its not a standalone field but my content filed contains some images. How do I parse that – Sam Apr 14 '14 at 09:11