user3207655
user3207655

Reputation: 188

Set Android setting for Dim screen programmatically

Ho do I set Android system settings to dim after a set period of time.

android.provider.Settings.System.putInt(getContentResolver(),
            Settings.System.DIM_SCREEN, time);

but Settings.System.DIM_SCREEN is deprecated.I also tried Power Manager PowerManager.SCREEN_DIM_WAKE_LOCK which is also deprecated Any other way around for the same.

Upvotes: 3

Views: 3644

Answers (1)

Amarjit
Amarjit

Reputation: 4357

WindowManager.LayoutParams WMLP = getWindow().getAttributes();
WMLP.screenBrightness = 0.15F;
getWindow().setAttributes(WMLP);

Upvotes: 2

Related Questions