Chris Arriola
Jul 17, 2023

Thanks for pointing that out! Yep, the example here would tie the composition's lifecycle to the Fragment's lifecycle which may outlive the View. That would also be equivalent to DisposeOnViewTreeLifecycleDestroyed. I wanted to give an example here that is not equivalent - go with what makes the most sense in your use case. Our official guidance is to use DisposeOnViewTreeLifecycleDestroyed for most cases, however. See https://developer.android.com/jetpack/compose/migrate/interoperability-apis/compose-in-views#compose-in-fragments

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Chris Arriola
Chris Arriola

Written by Chris Arriola

Android Engineer at Instagram Previously: Android Developer Relations Engineer at Google

No responses yet

Write a response