Did you read my reply to your original, exactly the same as far as I can tell, code?
On Wed, Aug 1, 2012 at 5:01 PM, Cythes <[email protected]> wrote: > Well after taking a few days off its time to hit the bricks again. So here > I am asking for help as to why my program is not setting the brightness > requested... Here is the code I have so far. > > import android.app.Activity; > import android.content.Intent; > import android.os.Bundle; > import android.provider.Settings; > import android.provider.Settings.SettingNotFoundException; > import android.view.WindowManager; > > public class bright extends Activity { > > @Override > protected void onCreate(Bundle savedInstanceState) { > // TODO Auto-generated method stub > super.onCreate(savedInstanceState); > int brightnessMode = 0; > try { > brightnessMode = Settings.System.getInt(getContentResolver(), > Settings.System.SCREEN_BRIGHTNESS_MODE); > } catch (SettingNotFoundException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > 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; // set 50% brightness > getWindow().setAttributes(layoutParams); > Intent i = new Intent(this, StartSpark.class); > i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); > startActivity(i); > finish(); > } > } > > I heard some place that when you do things like this you need to send out > a new window in order for it to refresh and take on the new brightness > properties. So that is why I have the intent set up at the bottom. > > I have been messing with this on my own for a while now but everything I > am trying is coming up dead... And not in the way I want it to be.. > > So what am I doing wrong? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

