Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9147625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:02:27+00:00 2026-06-17T11:02:27+00:00

I have both the phone number and address (including the zipcode) in the same

  • 0

I have both the phone number and address (including the zipcode) in the same TextView. I want the phone number to be clickable to call; however, this is making the zip code also clickable to make a phone call. How do I make it no longer clickable without creating another TextView? Thanks!

tvInfo.setText(Html.fromHtml("John Smith<br>123 Fake Street<br>Faketown, FK 12345<br><b>(804) 932-3300</b><br>"));

Linkify.addLinks(tvInfo, Linkify.PHONE_NUMBERS);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:02:29+00:00Added an answer on June 17, 2026 at 11:02 am

    android will regard digits with count >=5 as phone numbers. so I think there will be at least 2 solutions:

    1)a simple work around : if you are sure the length of phone numbers is more than 5, for example, at least 6 digits, you could make some work around:

    private final static int MY_PHONE_NUMBER_MINIMUM_DIGITS = 6;
    
    Linkify.addLinks(main, Patterns.PHONE, "tel:", new Linkify.MatchFilter() {
         public final boolean acceptMatch(CharSequence s, int start, int end) {
           int digitCount = 0;
    
           for (int i = start; i < end; i++) {
             if (Character.isDigit(s.charAt(i))) {
               digitCount++;
               if (digitCount >= MY_PHONE_NUMBER_MINIMUM_DIGITS ) {
                 return true;
             }
           }
         }
          return false;
        }
      }, Linkify.sPhoneNumberTransformFilter);
    

    this workaround is based on android source code of Linkify, in Linkify, the method:

    gatherLinks(links, text, Patterns.PHONE, 
                new String[] { "tel:" },
                sPhoneNumberMatchFilter, sPhoneNumberTransformFilter); 
    

    will be called, while sPhoneNumberMatchFilter will filter the digits less than 5:

    public static final MatchFilter sPhoneNumberMatchFilter = new MatchFilter() {
        public final boolean acceptMatch(CharSequence s, int start, int end) {
          int digitCount = 0;
    
          for (int i = start; i < end; i++) {
            if (Character.isDigit(s.charAt(i))) {
              digitCount++;
              if (digitCount >= PHONE_NUMBER_MINIMUM_DIGITS/*=5*/) {
                return true;
            }
          }
        }
        return false;
     }
    

    };

    so we just replace the “PHONE_NUMBER_MINIMUM_DIGITS” with 6

    2)a more complicated solution is, if your phone numbers are in a more specific format for example, must be something like “(xxx)xxx-xxxx”, you could use your own pattern to replace the Patterns.PHONE, to extract and apply links of phone numbers more accurately

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have both versions of maven running on the same computer?
I have a table of phone numbers, storing the phone number as varchar(20). I
I have an ST2 app that has a numberfield for the phone number: {
Let's say I have two tables ( Address and Phone ) in sql which
I have two tables (lets call them table A and B) both of them
I want a regular expression code which allows only numeric phone number (e.g 1234567890)
I have an unformatted telephone number string (5551234567). I would like to format this
I have a Web service and a Web site (both C#) in the same
I currently have a form that requests the user's email, cell phone number, and
MVC3 project. I have several classes: Account, Address, Phone etc. which I set up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.