Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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();
            }
        }
    }
}