I have an EditText
on Android I\'d for which I\'d like any embedded urls to be clickable. I used the Linkify
class, which has turned them blue and unde
Hope this will help someone
val message: String = String.format(
getString(R.string.message_content),
firstNameEditText.text,
lastNameEditText.text,
dateTextView.text,
timeTextView.text
)
val gMapURL = getString(R.string.google_map_location)
// Setup my Spannable with clickable URLs
val spannable: Spannable = SpannableString(gMapURL)
Linkify.addLinks(spannable, Linkify.WEB_URLS)
// Append a zero-width space to the Spannable
val gText = TextUtils.concat(spannable, "\u200B")
val finalText = TextUtils.concat(message, gText)
messageContentEditText.setText(finalText)