https://kotlinlang.org logo
Title
n

Nikita

08/27/2021, 5:42 PM
Hi guys, I faced with unexpected (in my opinion) behavior of LazyRow: I have row of N elements and I remember some state in itemContent lambda See screenshot: in logs I see "remember" every time when element appears on screen and as a result, I conclude that reusing of composables not working or I don't understand something Please tell me what am I doing wrong? thanks
a

Andrey Kulikov

08/27/2021, 5:44 PM
the items which are not visible anymore are disposed. which means their remembered value is disposed as well. however
rememberSaveable
will work as you expect
n

Nikita

08/27/2021, 5:52 PM
oh, thanks, it works! but my real case more complex: each element is AndroidView and when I scroll list - native View creates every time ("new android view" in logs)
AndroidView with TextureView inside and in "remember" I trying to persist non serializable data (ExoPlayer)