Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.view.WindowManager; public class Main { public static void setBrightness(Activity activity, int brightness) { if (activity != null) { try { WindowManager.LayoutParams params = activity.getWindow().getAttributes(); params.screenBrightness = brightness / 100f; activity.getWindow().setAttributes(params); } catch (Exception e) { e.printStackTrace(); } } } }