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

Seb Jachec

02/17/2023, 4:27 PM
We've got a user setting to choose light/dark/'system' theme, which updates the UI by providing different colors to
MaterialTheme
as needed. The only problem: the keyboard always matches the OS theme instead. Does anyone have any suggestions to fix this? I've seen mentions of
AppCompatDelegate.setDefaultNightMode
, but that seems to require my main activity to extend
AppCompatActivity
, for which the
setContent
extension function isn't available.
i

Ian Lake

02/17/2023, 4:53 PM
AppCompatActivity extends ComponentActivity (indirectly via FragmentActivity), so you can certainly use
setContent
there
s

Seb Jachec

02/17/2023, 5:03 PM
D'oh my bad, thank you! I should have run the app. Android Studio highlights
setContent
in red with 'unresolved reference' on hover, but the build does in fact succeed.