In my Android app I've got text views with links. Each of them is toggling a particular event (opening browser, starting another activity, etc...). To handle that, I haven't found any better solution than doing this:
hi there!, this is <u>a action</u> and this is <b>another action</b>. This third one goes to <a href="http://google.com>Google</a>
Then, when displaying the textview, I convert each link to a custom spannable with a SpannableStringBuilder.
I know this is hacky. And this is why I want to know if there's any other better way?
I've got two ideas:
Is it possible to implement custom spannables with their own marshalling system? For example a custom spannable matching tags like:
<div class="foo"></div>
Then I'd have a FooClickableSpannable
extending ClickableSpan
automatically detected with fromHtml()
- I could use custom url schemes to open my activities but I'm not sure how to force it not to display an app chooser if there are other alternatives.