Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; public class Main { public static void setScreeBrightness(int progress, Activity activity) { android.view.WindowManager.LayoutParams lp = activity.getWindow().getAttributes(); if (progress < 10) { progress = 10; } else if (progress >= 100) { progress = 99; } float f = progress * 1.0f / 100.0f; lp.screenBrightness = f; activity.getWindow().setAttributes(lp); } }