views:

70

answers:

1

I have a large text view that I am styling with a SpannableStringBuilder. I want to be able to assign custom click event handlers to certain spans of text. For example, if I click a superscript character I want it to pop up a toast with some information about what the superscript references. So far I have found linkify which helps to make regular expression type of things like emails and phone numbers launch appropriate activities. What I want to be able to do is define a span and its styling and assign a click handler to it. I haven't found anything built in that supports this kind of functionality and so I'm asking for anyone with a fresh idea of how to do this. Thanks.

+1  A: 

The only thing I can think of is for you to take a look at the Android source code for the Linkify class and see how that does it.

CommonsWare