简体   繁体   中英

twitter linkify android all @mentions

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);

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM