Screen Brightness

edited December 2016 in Android Mode

I'm trying to set screen brightness maximum but i couldn't do it somehow.

Here is my code:

` void setup(){ fullScreen(JAVA2D);

WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes(); lp.screenBrightness = 1; getActivity().getWindow().setAttributes(lp); } `

void draw(){ //somestuff }

When i run it, application crashes on the phone. Then in the console;

android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8128) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1220) at android.view.View.requestLayout(View.java:20085) at android.view.View.setLayoutParams(View.java:13597) at android.view.WindowManagerGlobal.updateViewLayout(WindowManagerGlobal.java:360) at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:97) at android.app.Activity.onWindowAttributesChanged(Activity.java:2858) at android.view.Window.dispatchWindowAttributesChanged(Window.java:894) at com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged(PhoneWindow.java:5057) at android.view.Window.setAttributes(Window.java:925) at processing.test.sketch_161217b.sketch_161217b.setup(sketch_161217b.java:48) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)

Answers

Sign In or Register to comment.