I can't follow your question, but the code your posted has problems.

First, please don't set Settings.System.SCREEN_BRIGHTNESS.  This is the
global brightness set by the user.  It should not be changed by the
application.  It is not intended to be changed by the application;
generally there are other things you need to poke to have the system pick
up the new value, and this is all in the realm of implementation details
that you shouldn't rely on and almost certainly will not work consistently
across devices and platform versions.

Second, you also have some code that is setting
WindowManager.LayoutParams.screenBrightness.
 If you set this on your full-screen window, then while it is displayed on
the user it will force the screen brightness to the value you set here.
 You do need to make sure your activity is full-screen.  If it is, and your
activity is in the foreground, it will cause the brightness to change.  In
this case you are immediately starting another activity and finishing the
current one, so it will only very briefly impact the screen brightness (if
it all) for however long that activity remains visible to the user.

On Sun, Jul 29, 2012 at 2:55 PM, Cythes <[email protected]> wrote:

> I'm now for sure 99% of the way complete on my code... I need to know one
> last thing. How do I programatically dim the of the android.
>
> I have tried making a set of intent groups. One loads the code for the
> dimmer then intents into the actual program and that runs with little issue
> other then the screen did not dim after the screen flipped over.
> Here is the code I am using:
> import android.app.Activity;
> import android.content.Intent;
> import android.os.Bundle;
> import android.provider.Settings;
> import android.view.WindowManager;
>
> public class bright extends Activity {
>  @Override
> protected void onCreate(Bundle savedInstanceState) {
>  // TODO Auto-generated method stub
> super.onCreate(savedInstanceState);
> Settings.System.putInt(this.getContentResolver(),
> Settings.System.SCREEN_BRIGHTNESS, 20);
>         WindowManager.LayoutParams lp = getWindow().getAttributes();
>         lp.screenBrightness =0.0f;// 100 / 100.0f;
>         getWindow().setAttributes(lp);
>         Intent i = new Intent(this, gateBridge.class);
>         i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>         startActivity(i);
> finish();
> }
> }
>
> Since I know brightness settings can only be used after the screen has
> been reset or changed.
>
> So the question, how do I get this done?
>
> --
> 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

Reply via email to