首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >twitter linkify android all @提及

twitter linkify android all @提及
EN

Stack Overflow用户
提问于 2013-02-14 18:24:09
回答 1查看 464关注 0票数 3

我想给一个链接,所有twitter @提及的mytweets应用程序在安卓。如果我点击@提及,我想打开另一个关于@提及的页面。

此代码不起作用。首先,我想搜索推文中的@提及,我给出了这个@提及的链接,如果我在推特中点击这个@提及,我想打开另一个关于这个@提及的页面。

代码语言:javascript
复制
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);
EN

回答 1

Stack Overflow用户

发布于 2013-02-14 18:30:19

试着这样做

代码语言:javascript
复制
 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);

请参阅此处的文档

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14872611

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档