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 8208411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:20:03+00:00 2026-06-07T09:20:03+00:00

Having the textView with autoLinkMask set to Linkify.ALL , i’m able to open the

  • 0

Having the textView with autoLinkMask set to Linkify.ALL, i’m able to open the links and the browser shows the web-page.

I need to call another activity that will do it with it’s webView not leaving the application.

Important notes:

  • changing the textView content is not an option, i need to have the links displayed as they are with the schemes they have,
  • there’s lot of text in the textView, not only the link.

I looked through movementMethod and IntentFilters, might miss something but looks like it can’t help.

So, any option to intercept the touched link in the TextView to do something with it not opening the browser ?

If you want to mention this SO question, please give some arguments why cause it doesn’t seem to solve the same problem as I have.

  • 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-07T09:20:04+00:00Added an answer on June 7, 2026 at 9:20 am

    Step #1: Create your own subclass of ClickableSpan that does what you want in its onClick() method (e.g., called YourCustomClickableSpan)

    Step #2: Run a bulk conversion of all of the URLSpan objects to be YourCustomClickableSpan objects. I have a utility class for this:

    public class RichTextUtils {
        public static <A extends CharacterStyle, B extends CharacterStyle> Spannable replaceAll(Spanned original,
        Class<A> sourceType,
        SpanConverter<A, B> converter) {
            SpannableString result=new SpannableString(original);
            A[] spans=result.getSpans(0, result.length(), sourceType);
    
            for (A span : spans) {
                int start=result.getSpanStart(span);
                int end=result.getSpanEnd(span);
                int flags=result.getSpanFlags(span);
    
                result.removeSpan(span);
                result.setSpan(converter.convert(span), start, end, flags);
            }
    
            return(result);
        }
    
        public interface SpanConverter<A extends CharacterStyle, B extends CharacterStyle> {
            B convert(A span);
        }
    }
    

    You would use it like this:

    yourTextView.setText(RichTextUtils.replaceAll((Spanned)yourTextView.getText(),
                                                 URLSpan.class,
                                                 new URLSpanConverter()));
    

    with a custom URLSpanConverter like this:

    class URLSpanConverter
          implements
          RichTextUtils.SpanConverter<URLSpan, YourCustomClickableSpan> {
        @Override
        public URLSpan convert(URLSpan span) {
          return(new YourCustomClickableSpan(span.getURL()));
        }
      }
    

    to convert all URLSpan objects to YourCustomClickableSpan objects.

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

Sidebar

Related Questions

I am having a situation in Graph page where LinearLayout should display the TextView
HI all, I am having a 2 textFeild and 1 textview. out of 2
I'm having trouble finding exactly the syntax I need to use to set the
I have a listview with custom row having a textview and a clickable image
I have listview having customized some textview and one imageview. When I long click
I am having an issue with my TextView. I have a PlayScreenActivity that displays
Typical search layout having RelativeLayout, TextView, EditText and Button I have a.9.png image having
I am having an issue where only the text of the first TextView (eventItemTitle)
I'm having a ListView . Each row of ListView contains 2 TextView . I
I have list with items having two textview and one imageview.I inflate the list

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.