Search code examples
androideclipsescreen-brightness

adjust brightness of LCD to minimum without seekbar in android device


GOOD DAY! im new in android programming, just want to ask this question.

adjusting the brightness of lcd/led to minimum in just 1 button? i am planning to make an application to save battery life for my own device. if it is possible please teach me how thank you!


Solution

  • Android Brightness Reference Developer link

    0 = dark bright.

    1 = full bright.

        click.setOnClickListener(new OnClickListener() {
    
            @Override
            public void onClick(View v) {
                WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
                layoutParams.screenBrightness = 0;        //brightness level
                getWindow().setAttributes(layoutParams);
            }
        });