bmo
06/25/2020, 11:23 AMjava.lang.IllegalArgumentException: Key 640122159 was already registered. Please call unregister before registering again
The code can be found here https://github.com/bmonjoie/ComposeTipsCalculator
I have seriously no idea what I'm doing wrong so if someone could give me any pointers, that would be really appreciatedAndrey Kulikov
06/25/2020, 12:30 PM(tips + null as TipsEntry?).forEach { entry ->
Entry(entry, onEntryChanged)
}
to
(tips + null as TipsEntry?).forEach { entry ->
key(entry) {
Entry(entry, onEntryChanged)
}
}
inside your Tips functionbmo
06/25/2020, 1:06 PM(tips + null as TipsEntry?).forEach { entry ->
val index = tips.indexOf(entry)
key(if (index < 0) tips.size else index) {
Entry(entry, onEntryChanged)
}
}
The first time I insert something in the empty field, it works. If i then proceed to the second line (now empty field) and type 1 number, the third line is added but if I enter again a number (in the second field, not changing the focus), it crashes with the same errorkey(index) {}
it crashes. If I remove the keyword data
from my TipsEntry
, it doesn't crash anymoreAndrey Kulikov
06/25/2020, 5:13 PM