0

Suppose the link share value for google link from api is

<a target='_blank' href='https://www.google.co.in/' target='_blank'>
     https://www.google.co.in/
</a>

<h5>
    <a target='_blank' href='https://www.google.co.in/' target='_blank'>
        Google
    </a>
</h5>
<section class='detail-hldr'>
    <blockquote class='smal-video-pnl'>
        <figure class='smal-video-thumb'> 
            <img src='https://www.google.co.in/images/icons/product/chrome-48.png' class='max-width370' alt='Google'> 
        </figure>
    </blockquote>
</section>"

How can this be shown in the newsfeed?. Do we need to use a textview or a combination of textview and imageview?
I have no idea, please help... expected output ..

enter image description here

Vipul Asri
  • 8,903
  • 3
  • 46
  • 71
Sanoop Vasu
  • 81
  • 1
  • 9

1 Answers1

0

I think you want to do like Facebook. In Web, we do this by extracting the meta-data from link and then displaying it accordingly. Here is the link to learn about Meta Tag and its component.

In Android, We can use metadata-extractor. Download the latest version .jar and import it into your project libs folder.

And then use the following code to get meta-data :

try {
            InputStream is = new URL("your image url").openStream();
            BufferedInputStream bis = new BufferedInputStream(is);
            Metadata metadata = ImageMetadataReader.readMetadata(bis,true);

      for (Directory directory : metadata.getDirectories()) {
       for (Tag tag : directory.getTags()) {
         System.out.println(tag);
       }
      }
    }catch (ImageProcessingException e){}
     catch (IOException e) {}

Referenced from this StackOverflow Answer.

Community
  • 1
  • 1
Vipul Asri
  • 8,903
  • 3
  • 46
  • 71