I want to parse a text for some links (url and phone numbers) and I've tried code
String message = "text text www.evz.ro test 1234567 test www.220.ro test Http://emm.ro";
SpannableString ss = new SpannableString(message);
Linkify.addLinks(ss, Linkify.ALL);
Object[] spans = ss.getSpans(0, ss.length() - 1, null)
What parameter should I use instead of null? What class type? I just need to know from where the link starts and where it ends
found the solution. here it is:
SpannableString spannableString = new SpannableString(str);
Linkify.addLinks(spannableString, Linkify.ALL);
URLSpan[] spans = spannableString.getSpans(0, spannableString.length() , URLSpan.class);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With