Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android Sets the system screen brightness     - Use libcurl library download url image (Programming)

- View processes and threads under Linux (Linux)

- How to use Git to upload code to GitHub project (Linux)

- C / C ++ various data types Conversion Summary (Programming)

- How to manage start-up applications in Ubuntu (Linux)

- Linux virtual machine settings network, hostname ssh access (Linux)

- Common Linux system performance monitoring command (Linux)

- Git uses a basic tutorial (Linux)

- Linux Change ssh port and disable remote root login at (Linux)

- Live Wallpaper for Linux release adds dynamic background (Linux)

- Java Foundation - Variables and data types (Programming)

- To get Java class / jar package path (Programming)

- Let the router be your security barrier against external attack (Linux)

- How VMware extend disk without rebooting the system (Linux)

- Python system default encoding (Programming)

- About Git (Linux)

- RedHat 6 xrdp use remote login interface (Linux)

- Linux AS4 VPN server in conjunction with a firewall perfect (Linux)

- Linux foreground to background process switch (Linux)

- Linux input and output redirection (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:      
 
- Docker deployment practices in Ubuntu (Server)
- Live Wallpaper for Linux release adds dynamic background (Linux)
- PostgreSQL using the system cache to improve operational efficiency (Database)
- Ubuntu 14.04 virtual machine switching desktop environments (Linux)
- Read and write files efficiently from Apache Kafka (Server)
- Linux using TCP-Wrapper Service Management (Linux)
- Ubuntu disable graphics card (Linux)
- Basic Tutorial: Linux novice should know 26 commands (Linux)
- Linux with Windows Explorer as a security system (Linux)
- Linux tmux tcpdump summary (Linux)
- Management Linux Container with Docker in Ubuntu (Linux)
- Linux processes in memory and memory cgroup statistics (Linux)
- Ubuntu Tutorial - Manually install Oracle Java JDK 8 (Linux)
- Sudo and Root Account in Ubuntu related (Linux)
- The YUM package management under Linux (Linux)
- Python object-oriented programming (Programming)
- Ubuntu set Swap Space Tutorial (Linux)
- Interesting example of Linux Sort command (Linux)
- MySQL management partition table (Database)
- Linux install deploy Ansible (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.