0

I am trying to achieve a functionality where user can click a part of a text such as the username or a hashtag in a string which is used by most social apps. There doesn't seem to be a way as of now. Any help will be most appreciated. Ti SDK 5.2.2 Android

blindbat
  • 87
  • 1
  • 5
  • Your problem is similar to [this question](http://stackoverflow.com/questions/1697084/handle-textview-link-click-in-my-android-app) Apart from [accepted answer](http://stackoverflow.com/a/3452944/805105) also check [this answer](http://stackoverflow.com/a/16644228/805105). – sohailehmad Aug 04 '16 at 15:30
  • you can use rich text. – DysaniazzZ Aug 04 '16 at 15:38

1 Answers1

1

Try to use an AttributedString. It allows you to display "html" like text. There is an easy to use module: https://github.com/FokkeZB/ti-html2as where you can set HTML text and it will convert it to an AttributedString.

So you would use a regular expression to convert you clickable elements (e.g. #element -> <a href="#element">#element</a>) and check for the click response

miga
  • 3,997
  • 13
  • 45