"Android" How to adjust the screen brightness, turn off the screen

Source: Internet
Author: User

650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Iahl5mqlicpyph1931fibvxnc3s2etiacdtdnodprvndnpf6ibvovy1btl9gefgheamtnmriovgwgm4lk8h6i1ps6eq/0?wx_fmt=jpeg "alt= "0?wx_fmt=jpeg"/>

Content Introduction

"Android" How to adjust the screen brightness, turn off the screen


"Android" How to adjust the screen brightness, turn off the screen


At work, record it.


Method 1:

PowerManager manager = (PowerManager) getsystemservice (Context.power_service); Powermanager.wakelock wl = Manager.newwakelock (Powermanager.partial_wake_lock, "Your Tag"); Wl.acquire (); Wl.release ( );

Remember to apply for permission in Androidmanifest.xml:

<uses-permission android:name= "Android.permission.WAKE_LOCK"/>


Method 2:

Windowmanager.layoutparams params = GetWindow (). GetAttributes ();p arams.flags |= layoutparams.flag_keep_screen_on; Params.screenbrightness = 0;getwindow (). SetAttributes (params);

This article is from the "Programmer Alliance Frogoscar" blog, so be sure to keep this source http://4526621.blog.51cto.com/4516621/1710423

"Android" How to adjust the screen brightness, turn off the screen

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.