Are Android generated ID really immutable?
<p>I have defined an Activity in an Android app containing 9 button. Each button have to listen to the same event listener.</p>

<p>Looking at generated R class, their Ids are defined :</p>

<pre><code> public static final int btn1=0x7f040001;
 ...
 public static final int btn1=0x7f040009;
</code></pre>

<p>My question is: it is ok to add the listeners cycling the ID in a for loop?</p>

<pre><code>for (int i= R.id.btn1; i&lt;=R.id.btn9;i++)
{
   Button button = (Button)findViewById(i);
   button.setOnTouchListener(new View.OnTouchListener() {
        @Override public boolean onTouch(View v, MotionEvent event) {
             ...
        }
   });
}
</code></pre>

<p>Or there in some situation in which Id get reassigned by the compiler, breaking my code? </p>

<p>I'm using Intellij Idea environment to build the app.</p>
