I have TextView with spans of type ClickableStringSpan defined as below:
public class ClickableStringSpan extends ClickableSpan {
private View.OnClickListener mListener;
int color;
public ClickableStringSpan(View.OnClickListener listener,int color) {
mListener = listener;
this.color = color;
}
@Override
public void onClick(View v) {
mListener.onClick(v);
}
@Override public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(color);
}
}
I set clickable spans on my text like this:
spanStr.setSpan(new ClickableString(new linkedTextClickListener(), linkColor),
startIndex, endIndex,
SpannableString.SPAN_INCLUSIVE_EXCLUSIVE);
Now I want to apply these string to EditTexts instead of TextViews. Everything is fine just Clickable strings are now not clicked anymore. I want to know how can I pass clicks on this sort of spans to their assigned clicklistener?
Update: My main concern to edit text is I want to allow user select some part of text and share it meanwhile he/she can click on ClickableSpans.