Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Reply
Developer
Posts: 164
Registered: ‎11-27-2012
My Device: Z10 LE,Dev Alpha C
My Carrier: China Mobile

android apps can't change the brightness of the playbook ?

I tried to change the bightness using the following code:

 

public static void setScreenBrightness(Activity activity, int value) {
WindowManager.LayoutParams params = activity.getWindow()
.getAttributes();
if (value > 255) {
params.screenBrightness = 1f;
} else if (value < 0) {
params.screenBrightness = 0f;
} else {
params.screenBrightness = value / 255f;
}

activity.getWindow().setAttributes(params);
}

public static void stopAutoBrightness(Activity activity) {
Settings.System.putInt(activity.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}

 

but doesn't works.

 

Is there some kind of limit or something? How can I change the brightness of Playbook from my android app?

Thanks.

BlackBerry Cascades / WebWorks developer, Vendor name: anpho