• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Add Tag to ClickableSpan

Cruclax

Lurker
Hi All,

I'm trying to store data in a ClickableSpan, like it can be done with setTag() with other type of elements.

I've read this answer in stackoverflow:
- Create your own subclass of ClickableSpan that holds the data you want, and apply it to your SpannableString.
- When you create the ClickableSpan and attach a word to it via a data member, you will have access to that data in onClick()

stackoverflow.com/questions/16005445/spannablestring-settag/16005451#16005451

I am using a class that extends ClickableSpan to create my clickable spans:

[HIGH]
public abstract class TouchableSpan extends ClickableSpan {
private boolean mIsPressed;

public void setPressed(boolean isSelected) {
mIsPressed = isSelected;
}

public void setTag(String string) {
this.setTag(string);
}

}
[/HIGH]

But I'm somewhat of a newbie and can't figure out how to code this.

Any help reaaaaaallly appreciated!!
 
Back
Top Bottom