Quantcast
Channel: How to make links in a TextView clickable - Stack Overflow
Browsing all 41 articles
Browse latest View live

Answer by Ashraf Gardizy for How to make links in a TextView clickable

Simple Solution using Kotlin Programming Languageactivity_main.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"...

View Article



Answer by Swapnil for How to make links in a TextView clickable

In kotlin you can dobinding.yourTextView.movementMethod = LinkMovementMethod.getInstance()your string should be in HTML format

View Article

Answer by Dustin for How to make links in a TextView clickable

Not to beat this to death, but here is what is happening under the covers with Linkfy, etc. You'll notice that setText() takes a CharSequence. Linkify, etc. converts the String to Spannable and adds...

View Article

Answer by Atakan Yildirim for How to make links in a TextView clickable

You can simply add links to your TextView with Android's Linkify library.For example, let's add a clickable legal notice TextView to our Activity.strings.xml<string name="text_legal_notice">By...

View Article

Answer by Ajaz Ahmed for How to make links in a TextView clickable

Add this to your EditText:android:autoLink="web"android:linksClickable="true"

View Article


Answer by Monster Brain for How to make links in a TextView clickable

For those who are having issues with strings reading from XML content and assigning dynamically.In case you are using text from a strings.xml resource, it seems that the HTML tags gets stripped out.So...

View Article

Answer by Muntashir Akon for How to make links in a TextView clickable

Use this:package com.stackoverflow.java.android;import android.content.Context;import android.text.method.LinkMovementMethod;import android.text.method.MovementMethod;import...

View Article

Image may be NSFW.
Clik here to view.

Answer by farhanjk for How to make links in a TextView clickable

Create an extension method on SpannableString:private fun SpannableString.setLinkSpan(text: String, url: String) { val textIndex = this.indexOf(text) setSpan( object : ClickableSpan() { override fun...

View Article


Image may be NSFW.
Clik here to view.

Answer by Keshav Gera for How to make links in a TextView clickable

Manage Linkify text color alsotv_customer_care_no.setLinkTextColor(getResources().getColor(R.color.blue));tv_customer_care_no.setText("For us to reach out to you, please fill the details below or...

View Article


Answer by Benny for How to make links in a TextView clickable

[Tested in Pre-lollipop as well as in Lollipop and above]You can get your HTML string from the backend or from your resources files.If you put your text as an resource string, make sure to add the...

View Article

Answer by Asesha George for How to make links in a TextView clickable

The following should work for anyone who is looking for a combination of text and hyperlink within an Android app.In string.xml:<string name="applink">Looking for Digital Visiting card? <a...

View Article

Answer by Pravesh for How to make links in a TextView clickable

The easiest thing that worked for me was to use LinkifyTextView txt_Message = (TextView) view.findViewById(R.id.txt_message);txt_Message.setText("This is link...

View Article

Answer by Rahul Raina for How to make links in a TextView clickable

Here is a very one-line Android code to make phone and URL selectable from textView no matter what the string is and what the data is. You don’t need to use any HTML tags for this.TextView textView =...

View Article


Answer by Kelly McKinnon for How to make links in a TextView clickable

The accepted answer is correct, but it will mean that phone numbers, maps, email addresses, and regular links, e.g., http://google.com without href tags will no longer be clickable since you can't have...

View Article

Answer by Ajay Kulkarni for How to make links in a TextView clickable

My code was like this: <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/link" android:text="@string/forgot" android:layout_marginTop="16dp"...

View Article


Answer by J.G.Sebring for How to make links in a TextView clickable

As the databinding is out, I'd like to share my solution for databinding TextViews supporting HTML tags with clickable links.To avoid retrieving every textview and giving them html support using...

View Article

Answer by luca992 for How to make links in a TextView clickable

I just wasted so much time to figure out you have to use getText(R.string.whatever) instead of getString(R.string.whatever)...Anyway, here is how I got mine working. With multiple hyperlinks in the...

View Article


Answer by onaclov2000 for How to make links in a TextView clickable

I use the autolink to "auto underline" the text, but I just made an "onClick" that manages it (I ran into this problem myself).<TextView android:layout_width="wrap_content"...

View Article

Answer by Akexorcist for How to make links in a TextView clickable

Add CDATA to your string resourceStrings.xml<string name="txtCredits"><![CDATA[<a href=\"http://www.google.com\">Google</a>]]></string>

View Article

Answer by DeathRs for How to make links in a TextView clickable

By using linkify:Linkify takes a piece of text and a regular expression and turns all of the regex matches in the text into clickable links:TextView textView = (TextView)...

View Article
Browsing all 41 articles
Browse latest View live




Latest Images