maybe for that version it'd be good to do some che...
# anko
k
maybe for that version it'd be good to do some checking to make sure IDs don't collide, as rare as that probably is, by doing a
findViewById
on the parent and making sure that it doesn't return anything
Copy code
private fun View.ensureHasId() {
    if (view.id != 0) return
    view.id = view.parent?.let { parent ->
        generateSequence { generateRandomNumber() }.first { parent.findViewById(it) == null }
    } ?: generateRandomNumber()
}