Is there a way how to remove "linkification" that was done by Linkify.addLinks(myEditText, Linkify.WEB_URLS);?
It should be disabled by Linkify.addLinks(myEditText, 0);, but it doesn't affect the linkified text at all. Even using myEditText.setLinksClickable(false); has absolutely no effect (links are still clickable).
The only solution I have come up with is a little hacky:
myEditText.setText(myEditText.getText().toString());
It should be disabled by Linkify.addLinks(myEditText, 0);
Given that the method name begins with "add", I am not surprised that it leaves existing stuff intact.
Is there a way how to remove "linkification" that was done by Linkify.addLinks(myEditText, Linkify.WEB_URLS);?
You can try to find and remove all URLSpan (or perhaps ClickableSpan) objects from the Spannable:
Spannable stuff=myEditText.getText();
URLSpan[] spans=stuff.getSpans(0, stuff.length(), URLSpan.class);
for (URLSpan span : spans) {
stuff.removeSpan(span);
}
// *maybe* need myEditText.setText(stuff), not sure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With