1

I used the method found in this link Android: Linkify TextView

public static void addLink(TextView textView, String patternToMatch,
        final String link) {
    Linkify.TransformFilter filter = new Linkify.TransformFilter() {
        @Override public String transformUrl(Matcher match, String url) {
            return link;
        }
    };
    Linkify.addLinks(textView, Pattern.compile(patternToMatch), null, null,
            filter);
}

My function call

addLink(text, "Forgot password?", "http://www.abc.com");

But the result ends up with "Forgot password?" The bold portion is blue and underlined. How do I include the "?" to become blue and underlined as well? Thanks.

Community
  • 1
  • 1
Maurice
  • 6,413
  • 13
  • 51
  • 76

1 Answers1

2

Second argument is pattern and you are adding ? (Regular expression character class char).

try this,

addLink(text, "Forgot password[?]", "http://www.abc.com");
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186