Home > database >  unresolved reference "Settings" in Kotlin
unresolved reference "Settings" in Kotlin

Time:09-24

I am trying to write some value in the System Settings property using putInt but getting an error. The compiler says "Unresolved Reference Settings". Please check the below code -

Settings.System.putInt(context.contentResolver, TEAMS_CAMERA_SHUTTER_STATUS, shutterOpen)
Settings.System.putInt(context.contentResolver, TEAMS_MIC_SWITCH_STATUS, muted)

Can anyone please help? Do I have to import anything extra for using this function? I am quite new in Kotlin and having really a hard time fixing it due to resource constrains.

CodePudding user response:

You have to import android.provider.Settings;

Tips: In Android Studio, wait for auto-complete to appear then press tab or enter. The required package will be imported automatically.

enter image description here

  • Related