Bug 7704 - No way to access WindowService from managed
Summary: No way to access WindowService from managed
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-10-06 11:47 UTC by Jérémie Laval
Modified: 2012-10-06 13:53 UTC (History)
2 users (show)

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

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:

Description Jérémie Laval 2012-10-06 11:47:56 UTC
WindowService is used with Context.GetSystemService to return a WindowManager (interface IWindowManager for us).

The problem is that this call returns a Window.LocalWindowManager object which is private and thus not generated in MonoDroid which means we don't have the glue to tie it to IWindowManager and thus the returned Java.Lang.Object can't be casted into a usable form in managed.
Comment 1 Atsushi Eno 2012-10-06 12:34:31 UTC
doesn't JavaCast<IWindowManager> () work? You need to use this method even for a return value that has publicly-bound API.
Comment 2 Jérémie Laval 2012-10-06 13:53:09 UTC
You are right, used to work for everything else so I was confused. JavaCast does the trick.