3
我想給所有twitter @mentions在android的mytweets應用程序鏈接。如果我點擊@註釋,我想打開另一個關於@註釋的頁面。twitter linkify android所有@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);
我tryed這個代碼,但在我的應用程序不能正常工作。 – baran 2013-02-14 11:53:43