0

I am working on a chat application. In this when a user copies text from somewhere and tries to paste in the EditText and send it using the send Button. The links in the text are not identified. When I set the textview to clickable and android:autoLink="web".

Still it's not working and I am also not getting a preview of the link like this one below:

here.

And help, would be great like how to proceed.Thank you !

Manish Khandelwal
  • 33
  • 1
  • 1
  • 10

1 Answers1

1

Here you go for html link:

TextView textView = findViewById(R.id.text_view);
Spanned spanned = Html.fromHtml("your html string");
textView.setText(spanned, TextView.BufferType.SPANNABLE);
textView.setMovementMethod(LinkMovementMethod.getInstance());

Make sure your don't have android:autoLink="web" https://stackoverflow.com/a/15299208/1329854

And for rich link preview check this answer:
https://stackoverflow.com/a/38217502/1329854