Bug 9668 - Window does not have a SetAttribute method
Summary: Window does not have a SetAttribute method
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.4.x
Hardware: PC Windows
: Highest major
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2013-01-18 06:21 UTC by Tomasz Cielecki
Modified: 2014-03-27 13:28 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample attempting to change brightness of screen, illustrating the missing SetAttributes method. (17.78 KB, application/octet-stream)
2013-01-18 06:21 UTC, Tomasz Cielecki
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Tomasz Cielecki 2013-01-18 06:21:14 UTC
Created attachment 3239 [details]
Sample attempting to change brightness of screen, illustrating the missing SetAttributes method.

It was discovered in a stackoverflow thread, that the Window class does not seem to have a SetAttribute method, which is usually used to update the Windows attributes. http://stackoverflow.com/questions/14391032/monodroid-how-to-adjust-device-screen-brightness-programmatically

For instance when attempting to set the brightness of the screen by changing Window.Attributes.ScreenBrightness nothing happens. Usually on native Android, you set the attribute with the setAttribute method like so:

WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.screenBrightness = 1;
this.getWindow().setAttributes(lp);

This seems to be missing from Mono for Android. A sample project has been attached attempting to show this method is missing.
Comment 1 Jonathan Pryor 2013-05-23 14:46:45 UTC
Window.setAttributes() was bound as the Window.Attributes property:

http://androidapi.xamarin.com/?link=P%3aAndroid.Views.Window.Attributes
Comment 2 Udham Singh 2014-03-27 13:28:41 UTC
I have checked this issue on following builds:

Windows 8.1
VS 2013
Xamarin Studio : 4.2.3 (build 60)
Xamarin.Android: 4.13.0 (Business Edition)

Screencast: http://screencast.com/t/KimDCryJ

As per comment 1, I am able to set the brightness of the screen. Hence I am closing this issue.