I want to make a part of my String into a clickable link. I have tried this:
TextView txt = findViewById(R.id.text);
String s = "Description <a href=\"url\">link text</a> here";
Spanned spanned;
txt.setMovementMethod(LinkMovementMethod.getInstance());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
spanned = Html.fromHtml(s,Html.FROM_HTML_MODE_LEGACY);
} else {
spanned = Html.fromHtml(s);
}
txt.setText(spanned);
txt.setLinksClickable(true);
And some other things but I can't bring it to work. What can I do?