'rich link preview in android

I am working on an application where I think rich link preview (whatsapp supports it,refer image) will be helpful for users but I am not able to get an idea to start on it.Any kind of suggestion/hint on how to do this will be helpful. enter image description here



Solution 1:[1]

Update here is the latest solution

implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.9'

in your XML

<io.github.ponnamkarthik.richlinkpreview.RichLinkView
    android:id="@+id/richLinkView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkView>

in java :

richLinkView = (RichLinkView) findViewById(R.id.richLinkView);
        
        
        
        richLinkView.setLink("https://stackoverflow.com", new ViewListener() {
            
            @Override
            public void onSuccess(boolean status) {
                
            }
            
            @Override
            public void onError(Exception e) {
                
            }
        });

For more styles visit

Library on GitHub

Old Answer

You can use this Android Link Preview library on github. for that just add the repository to your build.gradle file like this

repositories {
jcenter()
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy'}
     }

And you can use the artifacts like this:

dependencies {
compile 'org.jsoup:jsoup:1.8.3' // required
compile 'com.leocardz:link-preview:1.2.1@aar'

}

you can download a sample application from here

Solution 2:[2]

I am late in the party, but I have found new lib which provide easy to integrate and default preview style, i.e WhatsApp, Skype, Telegram etc...

implementation ‘io.github.ponnamkarthik:richlinkpreview:1.0.9’

Link Preview lib integration step by step

Please check easy implementation from above link

Solution 3:[3]

I found this library, I didn't try it but hope will work for you https://github.com/FreesoulApps/PreviewAndroid

Solution 4:[4]

I just tried and implement the Rich Link Preview feature into my app through URLEmbeddedView and it was working perfectly fine. Before that, i tried to implement almost all solutions but failed because mostly are outdated and do not support on the latest android API levels. Let me know if anyone is facing issue

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 xaif
Solution 2 Hitesh Dhamshaniya
Solution 3 Shashank Bhong
Solution 4 Muhammad Afzal