Challenge: Saving State - Boxes

These 2 functions didn’t do anything when i rotated the screen

override fun onSaveInstanceState(): Parcelable? {
        return super.onSaveInstanceState()

    override fun onRestoreInstanceState(state: Parcelable?) {

also Android studio didn’t allow me to use protected for them…

anyway what worked for me was

 override fun onDetachedFromWindow() {

    override fun onAttachedToWindow() {


i didn’t look around to do with Parcelable to be honest…

but for such situation i would divide the points of the boxen into Float Arrays and combine them after configuration change.

        boxen.forEach {
            println("Box= ${it.left}, ${}, ${it.right}, ${it.bottom}, ${it.end}, ${it.start}")

PS.I know this is for printing…