0

My utility app requires the user to select a meeting from the calendar, then it removes the non-numerical text, and parses what remains using some logic, with the final aim of identifying two numbers only.

Whenever the app fails to remain with 2 numbers only, I want to open a new activity in which the user will "tell" the app which 2 numbers are the relevant ones. So I want to display the meeting title, location, and description in 3 TextViews but all numbers should be clickable with a special onClick action that will trigger some methods that handle the identified two numbers... My question is about how to turn the numbers in the textViews to be clickable and have the special onClick action. I don't think I can use Linkify as I cannot put an onClickListener on the links. My only idea now is to turn the numbers into clickable buttons and add the relevant listener to the buttons. 1) Any suggestion on how to do this conversion other than simple step by step parsing? 2) Any better idea than using buttons?

Thanks a million

Omar
  • 7,835
  • 14
  • 62
  • 108
  • Have you tried `ClickableSpan`, as suggested [here](https://stackoverflow.com/questions/10696986/how-to-set-the-part-of-the-text-view-is-clickable)? – SqueezyMo Jun 20 '15 at 08:25
  • This is great. Seems the perfect solution for me.I see the ClickableSpan requires me to provide the indexes of first and last letter of the string I want to become clickable. I guess I will iterate of the text and create an array of the indexes. Then I will iterate over the array and create the ClickableSpans. – Omar Jun 20 '15 at 09:40

1 Answers1

0

call setOnClickListener(this) on the TextView and supply a onClick method in your code

Tuxxy_Thang
  • 179
  • 12
  • I don't want the whole TextView to be clickable. I want only parts of it to be like that... – Omar Jun 20 '15 at 09:43