I am creating a ClickableSpan, and it is displaying properly with the proper text underlined. However the clicks are not registering. Do you know what I am doing wrong??? Thanks, Victor Here is the code snippet:
view.setText("This is a test");
ClickableSpan span = new ClickableSpan() {
@Override
public void onClick(View widget) {
log("Clicked");
}
};
view.getText().setSpan(span, 0, view.getText().length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Kotlin util function:
Usage:
Have you tried setting the MovementMethod on the TextView that contains the span? You need to do that to make the clicking work...
After some trial and error, the sequence of setting the
tv.setMovementMethod(LinkMovementMethod.getInstance());
does matter.Here's my full code