I want to be able to assign view IDs in XML, but access them programmatically as integers for the sake of iterating over them easily.

Here's the direction I was going which does not work:

**values/value.xml:**

```
<resources>
    <integer name="int1">101</integer>
    <integer name="int2">102</integer>
    ...
    <integer name="int10">110</integer>
</resources>

```

**layout/fancy\_dialog\_fragment.xml:**

```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ...etc.>

    <Button android:id="@integer/int1" ... />
    <Button android:id="@integer/int2" ... />
    ...
    <Button android:id="@integer/int10" ...etc. />

</LinearLayout>

```

**FancyDialogFragment.java:**

```
for (int i = 0; i < 10; i++ ) {
    button[i] = (Button) getDialog().findViewById(100+i);
    button[i].setText("foo");
}

```