Skip to content Skip to sidebar Skip to footer

How Change Screen Led Like Cyanogenmod Widgetrenderfx Night Mod

i work about application how can change android screen brightness, can somme help me by giving some examples of how to doing this. Thanks :-)

Solution 1:

This peice of code will set the brightness:

privatevoidsetBrightness(int brightness) {
    try {
        IHardwareServicehardware= IHardwareService.Stub.asInterface(
            ServiceManager.getService("hardware"));
        if (hardware != null)
            hardware.setScreenBacklight(brightness);
        } catch (RemoteException doe) {          
    }        
}

Do not forget to add to your manifest

<uses-permissionandroid:name="android.permission.HARDWARE_TEST" />

Please check this full example

Solution 2:

You can use android settings for brightness.

 android.provider.Settings.System.putInt(getContentResolver(),
                android.provider.Settings.System.SCREEN_BRIGHTNESS,
                (int)progress);

for manualy settings which takes(0-255) as progress and

android.provider.Settings.System.putFloat(getContentResolver(),
                AppConstant.SCREEN_AUTO_BRIGHTNESS_ADJ, progress);

for automatic settings which takes(-1to 1) as progress

Post a Comment for "How Change Screen Led Like Cyanogenmod Widgetrenderfx Night Mod"