Issue
I have a paragraph in the xml
file. in that paragraph I have some string as a link like below:
which can be located at `<a href="https://www/tutorial.html">https://www.tutorial.com </a>.` this is
When clicking on it, it should launch the URL in the browser.
Is the implementation correct?
Solution
There are two ways of doing it.
You need to call setMovementMethod
:
textView.setMovementMethod(LinkMovementMethod.getInstance());
2nd
textView.setLinksClickable(true);
in XML should be
<TextView
android:id="@+id/textView"
android:autoLink="web"
android:linksClickable="true"
/>
Make sure you set your text using Html.fromHtml
in this way it will read the html anchor tags as anchor and clicking on it will open the browser.
you can also create a WebView
and pass the String of the link
as a URL
to open it in your Application
not using external browser.
I hope it helps.
Answered By - Sahil
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.