0

in Mono for Android I am trying to get the screen resolution of my hardware device with:

Android.Util.DisplayMetrics metric = new Android.Util.DisplayMetrics(); 
Game.Activity.WindowManager.DefaultDisplay.GetMetrics(metric);

I have an xperiaPlay with 480x854 resolution. But I get WidthPixel = 320 and HeightPixel = 569.

When I run a sample app from the original Java Android SDK, the debugger shows me the correct values. The values returned by Mono for Android are actually the values xdpi and ydpi in the Java SDK. If you multiply them with the density 1.5 you get the correct screen resolution.

I use MonoDevelop 2.8.5 and Mono for Android: 4.0.1.234125318

Any ideas? Because of that also the MonoGame demos do not run correctly on my device.

Thanks,

Timo

TAF
  • 23
  • 3
  • I came across a similar issue some time ago and found the same solution as you. I think this was due to old Android versions compatibility. – Narcís Calvet Dec 20 '11 at 12:42

1 Answers1

0

Finally found the solution. See the answer of that question as it also solve this problem. Metric numbers are correct after the right sdk version is entered into the manifest file:

MonoDroid apps don't use correct density drawables

Community
  • 1
  • 1
TAF
  • 23
  • 3