1

I have a string resource:

<string name="dialog"> text + 800-800-800 + text</string>

800-800-800 - is the phone number

I use this string in my Dialog:

The question is: how to make phone number clickable and onClick dial this number and call from the phone ?

I know how to make hyperlink using html <a href=""> tag, make TextView clickable and setMovementMethod() and navigate to website from the textview but there is another case, I need behavior such as it is Intent.ACTION_DIAL. My idea is make from my string 3 different strings, and for middle string with phone number set Onclick listener, but I think it`s work-around, maybe there is better way how to answer to my question?

Hope, I clearly explain my problem. Thank you!

VLeonovs
  • 2,193
  • 5
  • 24
  • 44

1 Answers1

2

Use ClickableSpan to make a String Clickable with onClick

http://developer.android.com/reference/android/text/style/ClickableSpan.html

Solution is explained on this page: How to set the part of the text view is clickable

Good luck!

Community
  • 1
  • 1
melkawakibi
  • 823
  • 2
  • 11
  • 26