Twitter link android all @mentions
I want to link to all twitter @mentions in mytweets app in android. If I click on @mentions, I want to open another page about @mentions.
This code doesn't work. First, I want to search for @mentions on twitter, and I link to this @mentions, and if I click this @mentions on tweet, I want to open another page about 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);
+3
source to share
1 answer
try it
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 documentation here
http://polamreddyn.blogspot.in/2013/01/android-text-links-using-linkify.html
0
source to share