Make screen go black - android

Is it possible in Android to make the screen go black? You can set the brightness to a low level but you cannot dim it until it goes black. Of course I could create an activity with just a black screen but would prefer an API that simply turns the screen off but not power down the device.

Related

How to duplicate Android Screen Saver mode in Android (switching off display LEDs where pixels are black)?

This is part of my curiosity, I want to make a simple android app which display few text in the middle with white color in a black background. I am trying this in a OLED display. I want the black pixel completley off. Is there any special method by which I accomplish this.

Always on without ambient mode? OR do not dim when enter ambient?

For experiment/user study purpose, I need to keep my screen on for few minutes.
I have follow the guide from http://developer.android.com/training/wearables/apps/always-on.html and it works partially for my purpose.
The code allows my screen always on BUT it will enter ambient mode after few seconds. I DO NOT want ambient mode.
My trick is I commented out onEnterAmbient(), onUpdateAmbient() and onExitAmbient().
So that my screen drawing is still the same color (not changing to black & white).
HOWEVER the screen is DIMMED darker when entering ambient mode.
I don't want the DIMMED effect, I need to keep my screen as bright as possible for the duration of my user study.
Anyone has any clue?
You may try
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
in your activity's onCreate() or use
android:keepScreenOn="true"
in your activity's layout. See this training material for details.

Any other way to set window brightness?

I maintain an auto-brightness app which uses an overlay to set screen brightness. The brightness is set through LayoutParams.screenBrightness.
Up to lollipop, I used TYPE_SYSTEM_OVERLAY for overlay type and everything was fine.
However, lollipop sees this overlay type as a threat or something and:
Doesn't turn on the screen automatically at all if such an overlay is present
If overlay is added later, the full screen notification such as alarm or incoming phone call will be suspended and reduced to notification bar
Naturally, this is a huge issue for me.
I have tested other window types and found that TYPE_PRIORITY_PHONE, TYPE_SYSTEM_ALERT, TYPE_TOAST all work (in the sense that they don't cancel the full-screen notification), but they won't respect brightness commands while in lock screen.
Is there any other way I could set screen brightness while in lock screen?

Refreshing screen brightness instantaneously

I'm trying to set System Screen Brightness instantaneously. I'm using a service to do that. Here it the code that I'm using.
Settings.System.putInt(cResolver,
Settings.System.SCREEN_BRIGHTNESS, 255);
This code works fine. But it is not instantaneous. The screen brightness value changes but the screen still looks dull. I can confirm this by reading back the screen brightness value and it is 255. If I lock the screen and come back, the screen is fully bright. How can I achieve this that the moment I set the system brightness to the maximum, I see fully bright screen?
BTW, I want to do this using a service and not an activity!
I would take a look at this link, specifically the first answer. It's a bit hackish though.
Changing screen brightness programmatically (as with the power widget)
Essentially you need to force the screen to refresh through starting a dummy activity and then finish() said dummy activity. I would have commented but I don't have enough points.

Resize Androids Home Softbutton

I have got the 2.2 android with Home button on screen(soft button), Now I need to change the size of that button to make wider and taller. Also that is embedded device so I have no app store etc. So how to change the buttons Bigger.

Categories

Resources