is Activity Auto Brightness - Android Activity

Android examples for Activity:Activity Background

Description

is Activity Auto Brightness

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.ContentResolver;
import android.provider.Settings;

import android.widget.Toast;

public class Main {

    public static boolean isAutoBrightness(Activity act) {
        boolean automicBrightness = false;
        ContentResolver aContentResolver = act.getContentResolver();
        try {/*from   w ww .  j  a va2  s  .  co m*/
            automicBrightness = Settings.System.getInt(aContentResolver,
                    Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
        } catch (Exception e) {
            Toast.makeText(act, "", Toast.LENGTH_SHORT).show();
        }
        return automicBrightness;
    }
}

Related Tutorials