I have an AndroidView as a part of a LazyColumn It...
# compose
v
I have an AndroidView as a part of a LazyColumn Item But when i navigate i can see thats its released and is recreated again when i navigate back Anyone knows how to fix this?
z
What behavior do you expect?
v
My AndroidView has a WebView in it Due to this it loads the webpage again when I navigate to a different screen and come back
as it is released and recreated again
s
That approach won't work because navigating away from the screen will dispose and release it. I believe it'll behave the same way with fragments and the navigation library since fragments get replaced and destroyed by default. You need to rethink the layout architecture. Maybe try caching the WebView content after it's loaded and reusing it. I'd suggest preserving the data but not the view, as that's generally recommended.
v
I have the html string preserved But as the webview is released and recreated it loads it again Same thing also happens when this WebView is in a LazyColumn