What is the range of R.id (min and max integer value) of any view

Viewed 1204

I am creating an android app in which I want to create Boolean Array of size of maximum value of IDs so that I can uniquely store the changes on the buttons.

Suppose my button id is 102931, when user click on the button I will make change in the Boolean array's 102931th element so that later I can check the changed value in it.

Now My Question is

What is the range of IDs(min-max) for any view?

1 Answers

They can be positive integers, but also, ids generated at build time will have a value greater than 0x00FFFFFF. If you look at View.generateViewId() you will see that dynamically generated ids are in range 1 to 0x00FFFFFF inclusive. Above that, there are R.id's ids.

The default id of a View is View.NO_ID which has value -1

Related