The
/** determines whether the emulator is. If true, it is currently the emulator
* @param context
* @return
*/
code is as follows |
copy code |
public static Boolean Isemulator (context context) { Telephonymanager TM = (Telephonymanager) context.getsystemservice (context.telephony_ SERVICE); String IMEI = Tm.getdeviceid (); if (IMEI = null | | imei.equals ("000000000000000")) { return true; } return false; } |
This method does not have a lot of test, should be work, the general true machine has IMEI, but also saw the construction machine IMEI is 000000000000000 or 0.
Two
sets the screen brightness of the current activity instead of setting the system's screen brightness, and then restores the system's brightness after exiting the current activity. Just look at the code, okay?
The code is as follows |
Copy Code |
Windowmanager.layoutparams LP = GetWindow (). GetAttributes (); lp.screenbrightness = 0.5f; GetWindow (). SetAttributes (LP); |
The range of screenbrightness values is 0 to 1. Be careful not to set to 0, the screen will be black, completely invisible.