5
Mi sono guardato intorno e ho potuto trovare solo il codice che imposterà la luminosità su quella attività. Sto cercando di cambiare le impostazioni effettive del telefono. Il codice che ho provato è:Android SDK: come si imposta la luminosità dello schermo
public class AutoPowerManagerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
adjustBright();
} catch (SettingNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void adjustBright() throws SettingNotFoundException {
// TODO Auto-generated method stub
int brightnessMode = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE);
if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.screenBrightness = 0.5F;
getWindow().setAttributes(layoutParams);
}
}
fa questo aiuto? http://stackoverflow.com/questions/6158628/android-short-screen-brightness-code Scusa se non sto capendo correttamente la tua domanda. – Kgrover