I\'m adding TextViews programmatically in a for-loop and add them to an ArrayList.
How do I use TextView.setId(int id)? What Integer ID do I come up wit
TextView.setId(int id)
inspired by @dilettante answer, here's my solution as an extension function in kotlin:
/* sets a valid id that isn't in use */ fun View.findAndSetFirstValidId() { var i: Int do { i = Random.nextInt() } while (findViewById(i) != null) id = i }