This is a pain, but yes. So Linkify basically does a few things. First, it scans the contents of the text box for the strings that match the strings of the URL. Then he creates UrlSpan and ForegroundColorSpan for those sections that correspond to him. Then it sets the MovementMethod from the TextView.
The important part here is UrlSpan. If you take a TextView and call getText (), notice that it returns CharSequence. This is most likely some kind of Spanned. From Spanned, you can ask getSpans () and explicitly UrlSpans. Once you know all the gaps you can do, scroll through the list and find and replace the old span objects with the new span objects.
mTextView.setText(someString, TextView.BufferType.SPANNABLE);
if(Linkify.addLinks(mTextView, Linkify.ALL)) {
Spannable spannable = (Spannable) mTextView.getText();
URLSpan[] spans = spannable.getSpans(0, spannable.length, URLSpan.class);
for (URLSpan span : spans) {
int start = spannable.getSpanStart(span);
int end = spannable.getSpanEnd(span);
int flags = spannable.getSpanFlags(span);
spannable.removeSpan(span);
URLSpan myUrlSpan = new URLSpan(Uri.parse(span.getUrl).addQueryParam("foo", "bar");
spannable.setSpan(myUrlSpan, start, end, flags);
}
mTextView.setText(spannable);
}
Hope this makes sense. Linkify is just a good tool for setting the correct intervals. Whitespace is simply interpreted when rendering text.