[mono-android] Problem with WindowManager

Narcís Calvet narcis at steema.com
Tue Mar 15 11:23:17 EDT 2011


Hello,

 

I’m trying to get the display size using the code below in an Activity.

 

      Java.Lang.Object windowService =
this.GetSystemService(Android.Content.Context.WindowService);

      Android.Views.IWindowManager windowManager = windowService as
Android.Views.IWindowManager;

      Android.Views.Display display = windowManager.DefaultDisplay;

      String str = display.Width.ToString() + " x " +
display.Height.ToString();

 

I’d bet this worked last week. Has there been any change in this field in
preview 14? Do I miss anything? The line where the code fails is when
casting the windowService object to Android.Views.IWindowManager. The
debugger says it’s a android.view.Window$LocalWindowManager but this type is
not available. Finally the program finishes with this exception:

 

In mgmain JNI_OnLoad

Stacktrace:

 

The program 'Mono' has exited with code 255 (0xff).

 

Thanks in advance.

 

 

Best Regards,

Narcís Calvet

Steema Software

http://www.steema.com <http://www.steema.com/> 

http://twitter.com/SteemaSoftware

https://www.facebook.com/SteemaSoftware

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110315/033ce909/attachment.html 


More information about the Monodroid mailing list