Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android Sets the system screen brightness     - Hadoop 2.6.0 standalone configuration and pseudo-distributed configuration under Ubuntu 14.04 (Server)

- SHELL script to use anti SSH brute force and vsftpd (Linux)

- Troubleshooting Linux virtual machine device id and the letter of inconsistencies (Linux)

- ActiveMQ-based shared file system HA solutions (Server)

- How a lot of blocking malicious IP address in Linux (Linux)

- VMware Workstation virtual machine Ubuntu achieve shared with the host (Linux)

- RHEL7.0 log system (Linux)

- To share Linux script automatically change passwords (Linux)

- C ++: Postmodern systems programming language (Programming)

- JQuery implements the same content merge cells (Programming)

- Swift defined type conversion and type aliases (typealias) (Programming)

- Introduction and MongoDB CRUD (Database)

- Error: Unable to establish connection with FTP SFTP server (Server)

- Ubuntu 14.04 installation configuration GNOME Classic interface (Linux)

- To resolve Ubuntu 14.04 Unity Desktop Environment Login freeze problem (Linux)

- How Ubuntu Snappy Core 2 running on Raspberry Pi (Linux)

- Linux System Getting Started Learning: modify environment variables in Linux PATH (Linux)

- Automatic batch resolve dependencies problem locally installed rpm package (Linux)

- Docker + OpenvSwitch build experimental environment VxLAN (Server)

- To install minimize RHEL / CentOS 7 (Linux)

 
         
  Android Sets the system screen brightness
     
  Add Date : 2017-08-31      
         
       
         
  Android Sets the system screen brightness

Permissions
< Uses-permission android: name = "android.permission.WRITE_SETTINGS"> < / uses-permission>
 
 
/ **
* Get the current screen brightness mode
* SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1 to automatically adjust the screen brightness
* SCREEN_BRIGHTNESS_MODE_MANUAL = 0 to adjust the screen brightness manually
* /
Private int getScreenMode () {
Int screenMode = 0;
Try {
ScreenMode = Settings.System.getInt (getContentResolver (), Settings.System.SCREEN_BRIGHTNESS_MODE);
}}
Catch (Exception localException) {

}}
Return screenMode;
}}

/ **
* Get the current screen brightness value 0--255
* /
Private int getScreenBrightness () {
Int screenBrightness = 255;
Try {
ScreenBrightness = Settings.System.getInt (getContentResolver (), Settings.System.SCREEN_BRIGHTNESS);
}}
Catch (Exception localException) {

}}
Return screenBrightness;
}}
/ **
* Sets the mode for the current screen brightness
* SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1 to automatically adjust the screen brightness
* SCREEN_BRIGHTNESS_MODE_MANUAL = 0 to adjust the screen brightness manually
* /
Private void setScreenMode (int paramInt) {
Try {
Settings.System.putInt (getContentResolver (), Settings.System.SCREEN_BRIGHTNESS_MODE, paramIn);
} Catch (Exception localException) {
LocalException.printStackTrace ();
}}
}}
/ **
* Set the current screen brightness value 0--255
* /
Private void saveScreenBrightness (int paramInt) {
Try {
Settings.System.putInt (getContentResolver (), Settings.System.SCREEN_BRIGHTNESS, paramInt);
}}
Catch (Exception localException) {
LocalException.printStackTrace ();
}}
}}
/ **
* Save the current screen brightness value, and make it effective
* /
Private void setScreenBrightness (int paramInt) {
Window localWindow = getWindow ();
WindowManager.LayoutParams localLayoutParams = localWindow.getAttributes ();
Float f = paramInt / 255.0F;
LocalLayoutParams.screenBrightness = f;
LocalWindow.setAttributes (localLayoutParams);
}}
     
         
       
         
  More:      
 
- The mv command to move the directory two cases under Linux (Linux)
- Linux System Administrator Network Security Experience (Linux)
- Oracle Bug caused by the collection of AWR Snapshot fault (Database)
- Ubuntu 15.04 installed JDK and configured as the default JDK (Linux)
- Linux kernel RCU (Read Copy Update) lock Brief (Linux)
- Safe learning through self-extracting package to achieve invasion (Linux)
- Lua and C ++ (Programming)
- To use Linux to create a secure managed gateway (Linux)
- Restore database fault encountered ORA-0600 (Database)
- How to find on Linux and delete duplicate files: FSlint (Linux)
- In the case of using cgroups Ubuntu 14.04 and Docker (Linux)
- Ubuntu 12.04 LTS installation configuration JDK1.6.0_45 (Linux)
- MySQL binlog group to submit XA (two-phase commit) (Database)
- File SUID, SGID, Sticky property (Linux)
- CentOS7 method to upgrade the kernel to 3.18 (Linux)
- 10 really interesting Linux command (Linux)
- About MongoDB query method according to fuzzy field (Database)
- Ubuntu Backup and Recovery (Linux)
- Linux firewall security (Linux)
- What is Unikernel? (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.