I am trying to set the screen brightness from a widget. We know this is easily possible since tons of widgets do this already, but how.....
In a service I call from
Shameless copy&paste from Changing the Screen Brightness System Setting Android
android:theme="@android:style/Theme.Translucent.NoTitleBar"
does it all.
For the blackscreen, set a theme on the activity, containing this:
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
Thanks Sebastian for the answer, I've copied it in here.