set Screen Brightness - Android android.app

Android examples for android.app:Screen

Description

set Screen Brightness

Demo Code

import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;

public class Main{

    public static void setScreenBrightness(final Activity mActivity,
            final float pScreenBrightness) {
        final Window window = mActivity.getWindow();
        final WindowManager.LayoutParams windowLayoutParams = window
                .getAttributes();//from   www .j  a va2  s .  c o  m
        windowLayoutParams.screenBrightness = pScreenBrightness;
        window.setAttributes(windowLayoutParams);
    }

}

Related Tutorials