title: Android - findViewById() and dynamically setting ID's
body: <p>I have a poll of ID's (<code>ids.xml</code>), and I assign id's for views I create dynamically. Now my question is pretty simple - assume I create a new view and assign it an id with <code>setId()</code> in conjuction with <code>R.id.uniqueId</code>. Later on, can I access the view with <code>findViewById(R.id.uniqueId)</code>?</p>
  
  <p>If so, what could be the reason it returns null?</p>
  
  <p>Here is a toy example: <strong>UPDATED</strong></p>
  
  <pre><code>LinearLayout l = new LinearLayout(this);
  l.setId(R.id.mId);
  setContentView(l); //i see on screen the views added to 'l'
  l = (LinearLayout) findViewById(R.id.mId); //it returns null :(
  </code></pre>
  
  <p>How come it does not register\map the assgined ID to the view it was assigned?</p>