I\'m working on ClickableSpan in a TextView, and I\'m trying to get the clicked span\'s text. This is my code.
// this is the text we\'ll be ope
try this:
public class LoremIpsumSpan extends ClickableSpan {
@Override
public void onClick(View widget) {
// TODO add check if widget instanceof TextView
TextView tv = (TextView) widget;
// TODO add check if tv.getText() instanceof Spanned
Spanned s = (Spanned) tv.getText();
int start = s.getSpanStart(this);
int end = s.getSpanEnd(this);
Log.d(TAG, "onClick [" + s.subSequence(start, end) + "]");
}
}