TextViewWithLinks

Additional

Language
Java
Version
N/A
Created
Mar 19, 2014
Updated
Mar 20, 2014 (Retired)
Owner
Frederico Silva (fredericojssilva)
Contributor
Frederico Silva (fredericojssilva)
1
Activity
Badge
Generate
Download
Source code

TextViewWithLinks

TextView With Link handler

##Usage

String text = "bananas on www.bananas.ba and  <a href=\"http://google.com/\">Google</a>";

TextViewWithLinks textview = new TextViewWithLinks(this);
textview.setText(Html.fromHtml(text));
textview.linkify(new TextViewWithLinks.OnClickLinksListener() {
 @Override
 public void onTextViewClick() {
  // Do whatever you want
 }
   
 @Override
 public void onLinkClick(String url) {
  // Do whatever you want
 }
});
  
//SET Colors
textview.setLinkColors(Color.RED, Color.BLACK);
  
setContentView(textview);