I am sending message from web application to android mobile which contains some mobile number, But that mobile number is not clickable to set calls from there.
-
3share text what you are sending in SMS. – SilentKiller Sep 08 '14 at 12:07
-
"I am sending message" >> what kind of message ? SMS ? GCM ? – 2Dee Sep 08 '14 at 12:08
-
Thanks bro for replying, text i am sending is "my number is +10XXXXXX" to my users but the number is not clickable from there message box. – Sandesh Kumar Singh Sep 08 '14 at 12:10
2 Answers
how about this?
if you can use TextView,
there is two way of autolink
1) Linkify in JavaCode
ex>
public class LinkifyActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView txtPhone1 = (TextView)findViewById(R.id.txtPhone1);
Linkify.addLinks(txtPhone1, Linkify.PHONE_NUMBERS);
TextView txtPhone2 = (TextView)findViewById(R.id.txtPhone2);
Linkify.addLinks(txtPhone2, Linkify.PHONE_NUMBERS);
TextView txtWeb = (TextView)findViewById(R.id.txtWeb);
Linkify.addLinks(txtWeb, Linkify.WEB_URLS);
}
}
all => Linkify.ALL
e-mail => Linkify.EMAIL_ADDRESSES
address => Linkify.MAP_ADDRESSES
web URL => Linkify.WEB_URLS
phonenumber => Linkify.PHONE_NUMBERS
2) AutoLink in xml
ex>
<TextView
android:id="@+id/txtAutoWeb"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="01012341234" />
the number is not contain -(hyphen), it dosen't matter.

- 101
- 1
- 7
-
The intent is to show the SMS clickable and not a link in the app as clickable – Psypher Sep 15 '14 at 17:56
-
@Ranjith hmm.. are you looking for like [this](http://beradrian.wordpress.com/2010/01/15/special-links)? i hope is it helpful.. – bemaru Sep 27 '14 at 12:55
you may use SpannableString
and/or SpannableStringBuilder
here is a question about it
and here is Docs about it
so you may need to send your message separated with special separator
then add it to textView wrapped in SpannableString
ex, data bla bla#SEP#+963xxxxxxx#SP#data2 bla bla
so you get this String and split it, and apply SpannableString
String msg = getMsgFromServer();
String msgParts[] = msg .split("#SEP#");
check qustion above to complete , it has handling for onClick
on each spannable item.