title: Are Android View id supposed to be unique?
body: <p>Ok so something  that I am confused with is whether Android ids need to be unique or not. Here is why the confusion arises:<br>
  Let's just say there is an <code>Activity</code> that has an <code>TextView</code> (android:id="text") and a <code>Button</code> (android:id="button"). The <code>Button</code> sets the text of the text view to a random text. So, to add a listener, I will retrieve <strong>the</strong> button as<br>
  <code>Button b = (Button) findViewById(R.id.button)</code> and then add listener to do the task.<br>
  Now, I can refer to this <strong>same</strong> TextView from a <code>DialogFragment</code>, a <code>Fragment</code> and what not with the same id <code>R.id.text</code> and all the changes will ever be applied to this text view without doubt.  </p>
  
  <p>In case of subclassing <code>BaseAdapter</code>, you need to override the <code>getView</code> where you do the inflating if necessary and if not, you make changes. Now, you retrieve the <code>Views</code> in almost the same way. Almost.<br>
  You do a <code>convertView.findViewById(..)</code>.  </p>
  
  <p>If all the views need to have a unique id, how does changing the content of <code>View</code> in the <code>getView</code> not result in haphazard behavior ?<br>
  I mean, all the views inflated have the same id as defined in layout.  </p>
  
  <p><em>My understanding is that the ids are unique in the context of the view that inflated them. Since I am a beginner, I am asking for clarification</em>  </p>
  
  <h3> Update after Ahmad's answer </h3>  
  
  <p>So, what this means is I can not inflate two <code>Fragment</code> in an <code>Activity</code> by using the same layout. This will result in an exception. Both are inflated by the same <code>Activity</code>, hence belong to the same instance. The ids will conflict</p>