https://kotlinlang.org logo
#compose
Title
# compose
k

Kevin Hester

02/13/2020, 3:55 PM
before I make something (possibly ugly) myself, is there something like a WithActivity {} or WithApplication {} Compose functions to provide the current activity or application context (which is sometimes needed for low level android calls). I've looked through https://developer.android.com/reference/kotlin/androidx/compose but so far no luck.
z

Zsolt

02/13/2020, 3:58 PM
I wonder if context ambient would do the job for your case?
l

Leland Richardson [G]

02/13/2020, 3:59 PM
yeah, do you need Context or Activity?
ContextAmbient.current
will get you the former
❤️ 2
we don’t currently have an Activity ambient, and i’m not sure if we want to add one
but you can add one yourself pretty easily
k

Kevin Hester

02/13/2020, 4:59 PM
Ohh - ContextAmbient is perfect for me. thanks! btw - is there any top level meta document on using Compose or at this point is it basically the tutorial + the javadocs?
l

Leland Richardson [G]

02/13/2020, 6:24 PM
tutorials and docs are pretty much the only official things we have at the moment, sorry
APIs are changing pretty dramatically still at this point so we don’t want to waste too much effort documenting things in ways that will be outdated
👍 2
🙏🏼 1
k

Kevin Hester

02/14/2020, 12:48 AM
gotcha. no worries! I'll try not to be too pesty with questions tho.
l

Leland Richardson [G]

02/14/2020, 12:49 AM
no worries! ask away! that’s partially why this slack channel is here
k

Kevin Hester

02/14/2020, 12:50 AM
oh yah - I bet it is a goldmine of 'oh, here's what we'll need to document or here's usecases that actual users are trying'
l

Leland Richardson [G]

02/14/2020, 12:55 AM
yeah it is
2 Views