I am creating an EditText object which I then try to reference in a unit test. What is the best way to add a new id to R.id for this d
EditText
id
R.id
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 }