How to make markdown links and normal urls clickable in same textview.

I have a string, with two types of links inside it.

One is markdown and the other is normal link.

I want both of them to be clickable inside a textView.

This is the string :

String myString = "[google]("

I converted myString to HTML using AndDown library.

AndDown andDown = new AndDown(); String convertedString = andDown.markdownToHtml( myString );

The value of convertedString now :


Now if I set the textview as below :

textView.setLinksClickable(true); body.setMovementMethod(LinkMovementMethod.getInstance()); body.setText(convertedString);

This is how my textView looks like :


google is now clickable, where as is not recognized as a link, it's printed as a normal word.

To solve this I used :


This made clickable, but google is now not recognized as link, but is displayed as a normal word.

So, I need a solution to make them both clickable, without trading off either of them.

Category:android Time:2018-11-29 Views:3

Related post

Copyright (C), All Rights Reserved.

processed in 0.976 (s). 13 q(s)