3

Androidのmytweetsアプリですべてのtwitter @メンションにリンクを付けたいです。@メンションをクリックすると、@メンションに関する別のページが開きます。

このコードは機能しません。まず、ツイートで @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);
4

1 に答える 1

0

このようにしてみてください

 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

于 2013-02-14T10:30:19.403 に答える