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?

Answers


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().


Need Your Help

How to count swaps in a quicksort? (Python)

python algorithm list counter quicksort

Hello I have this code and I don't know how to count how many exchanges it does :(

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.