Or if you have an Activity or View, you can just access the 
WindowManager property.

Jonathan

On 9/27/2011 10:27 AM, Jonathan Pryor wrote:
> On Sep 27, 2011, at 10:12 AM, tsukrov wrote:
>> mWindowManager = 
>> (IWindowManager)context.GetSystemService(Context.WindowService);
>
> Sadly, this is a "leaky abstraction" -- Context.GetSystemService() returns a 
> Java.Lang.Object(), so our generator has no idea what type it could be. 
> Furthermore, the type returned is a private type, with no public Managed 
> Callable Wrapper (MCW) class (because atm Java.Lang.Object.GetObject() 
> doesn't check implemented interfaces when trying to find the most-derived MCW 
> type).
>
> Consequently, you need to do an "extra-langual" cast:
>
>       mWindowManager = 
> context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();
>
> using the Android.Runtime.Extensions.JavaCast<T>() method:
>
>       
> http://docs.mono-android.net/index.aspx?link=M%3aAndroid.Runtime.Extensions.JavaCast``1(Android.Runtime.IJavaObject)
>
> Thanks,
>   - Jon
>
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to