【发布时间】:2013-02-14 10:24:08
【问题描述】:
我想在 android 的 mytweets 应用上提供所有 twitter @mentions 的链接。如果我点击@mentions,我想打开另一个关于@mentions 的页面。
此代码不起作用。首先,我想在推文中搜索@mentions,然后给出这个@mentions 的链接,如果我在推文中点击这个@mentions,我想打开另一个关于这个@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);
【问题讨论】:
标签: java android tweets linkify