How to generate a view id in code?
I need to create some views in code and want to assign an id for the view. How can I generate a view id that is guaranteed to be unique among the rest of the view ids but do this at runtime?
IDs of Views don't need to be unique across the whole application, but only in the view hierarchy. With that said, if you want it to be unique, maybe you can use hashCode() and then pass it to View.setID().