3

I want to give a link all twitter @mentions on mytweets app in android. If I click on @mentions I want to open another page about of the @mentions.

This code do not work. Firstly I want to search @mentions in tweet and I give link this @mentions and if I click this @mentions in tweet I want to open another page about of the this @mentions.

TextView bt = (TextView) v.findViewById(R.id.bottomtext);
Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)");
String atMentionScheme = "http://twitter.com/";

TransformFilter transformFilter = new TransformFilter() {

    public String transformUrl(final Matcher match, String url) {
        return match.group(1);
    }
};

Linkify.addLinks(bt, Linkify.ALL);
Linkify.addLinks(bt, atMentionPattern, atMentionScheme, null, transformFilter);
Mualig
  • 1,444
  • 1
  • 19
  • 42
baran
  • 423
  • 1
  • 4
  • 5

1 Answers1

0

try like this

 textView.setAutoLinkMask(0);    

// Recognize phone numbers and web URLs
Linkify.addLinks(text, Linkify.PHONE_NUMBERS | Linkify.WEB_URLS);

// Recognize all of the default link text patterns 
Linkify.addLinks(text, Linkify.ALL);

// Disable all default link detection
Linkify.addLinks(text, 0);

see here is documentation

http://polamreddyn.blogspot.in/2013/01/android-text-links-using-linkify.html

NagarjunaReddy
  • 8,621
  • 10
  • 63
  • 98