title: Android set autoLink attribute programmatically
body: <pre><code>&lt;TextView
      android:text="123456789"
      android:autoLink="phone"&gt;
  &lt;/TextView&gt;
  </code></pre>
  
  <p>I want to create this TextView from code, however I am encountering countless problems.</p>
  
  <p>In the first place, I got halfway creating a TextView and adding this:</p>
  
  <pre><code>tw_phone.setAutoLinkMask(0x04);
  </code></pre>
  
  <p>This resulted in a clickable TextView, but when you clicked, a toast said "No application can perform this action", or something similar. I also tried with</p>
  
  <pre><code>Linkify.addLinks(tw_phone, Linkify.PHONE_NUMBERS); //and .ALL
  </code></pre>
  
  <p>but it gave me the same result. </p>
  
  <p>When I decided to ask on StackOverflow, I tried to strip my code down incase there were something wrong with the way I have used Layouts (you never know), but now I'm not even able to make a TextView clickable. This is the code that, in my opinion, should work as it is just a stripped down version of what I am using deeper in my code.</p>
  
  <pre><code>TableLayout table = (TableLayout) findViewById(R.id.tableResult);
  TableRow row = new TableRow(this);
  TextView tw = new TextView(this);
  tw.setText("123456789");
  tw.setAutoLinkMask(Linkify.ALL);
  row.addView(tw);
  table.addView(row);
  </code></pre>
  
  <p>Can someone write a simple, small example of how you create a TextView, give it a number as text and then allows the user to click on it and choose whatever app they want to open the number with?? 
  If you can point out whats wrong in my code aswell, that would be great, but I would much rather just get the answer straight away. The things I have tried are taken from other StackOverflow questions and answers.</p>