Android Linkify makes not phone number clickable
I am trying to make clickable phone number 0900-123 4567 in textview with simple code. On some phones and android versions it works, on some not. Mostly only 0900-123 is clickable, 4567 is not added. Sometimes on the same phone number is clickable when phone language is english but not clickable when language is french. Any idea how it can be fixed to work everywhere ?
acceptMatch procedure is hit and returns true always
TextView tv = (TextView) findViewById(R.id.test);
Pattern pattern = Pattern.compile("[0-9]{4}-[0-9]{3} [0-9]{4}");
Linkify.MatchFilter matchFilter = new Linkify.MatchFilter() {
@Override
public final boolean acceptMatch(CharSequence s, int start, int end) {
if (s != null && s.subSequence(start,end).toString().equals("0900-123 4567"))
return true;
else
return false;
}
};
Linkify.addLinks(tv, pattern, "tel:", matchFilter, null);
<TextView
android:id="@+id/test"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="Hello 0900-123 456 (some other text)."/>
链接地址: http://www.djcxy.com/p/74644.html