If I use myView.setId(View.generateViewId())
(View.generateViewId()) in multiple libraries, is it guaranteed to be unique across all libraries or is the value only guaranteeed to be unique in each library itself?
Asked
Active
Viewed 99 times
1

stefan.at.kotlin
- 15,347
- 38
- 147
- 270
1 Answers
0
All these IDs are unique within same ApplicationContext. I'm not sure that methods is thread safe, so pay attention in multithread applications. This method generates very low IDs (usually starting from 1) at Runtime, so if nr.1 is already taken, it will try n.2 and so on until a free number is found.

emandt
- 2,547
- 2
- 16
- 20