0

I want to create an android link (with a certain name) that show a given html string in a local web browser. I need to use TextView but it seems to not work.

that's what I get from the logs:

URLSpan : Actvity was not found for intent, Intent { act=android.intent.action.VIEW dat= here is the html string

this is the code:

link = "<a href="" + HtmlString + "">" + link_name + "";

TextView name = ((TextView) findViewById(relevent_int));

            name.setText(Html.fromHtml(link, Html.FROM_HTML_MODE_LEGACY));
yehuda gilad
  • 13
  • 1
  • 5
  • [https://stackoverflow.com/a/26747105/3022836](https://stackoverflow.com/a/26747105/3022836) – Kunu Apr 20 '21 at 13:00

1 Answers1

0

I assume that you want to browse to a website, so make sure the the URL is well-formed as "http://whatever" or "https://whatever". Here is an example:

val urlString = "https://stackoverflow.com"
val link_name = "Stack Overflow"
val link = "This is the link: <a href=\"" + urlString + "\">" + link_name + "</>"

This will browse to Stack Overflow. If you still have trouble, check the URL in the debugger to make sure it has the correct format.

Cheticamp
  • 50,205
  • 8
  • 64
  • 109