Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Description: when using the android.util.DisplayMetrics class in native Android code (no Xamarin whatsoever) to obtain device display characteristics of a Xamarin Android Player device, the the xdpi and ydpi fields always seem to report 100 instead of the correct value. When doing the same experiment on a stock Android emulator, these fields report the correct values.
Steps to reproduce: in Eclipse, create a simple Hello World project for Android. Place the following code in the onCreate method of the MainActivity class:
TextView t = (TextView)findViewById(R.id.my_label);
t.setText("X dpi: " + metrics.xdpi + "\nY dpi: " + metrics.ydpi);
Run the code on a Xamarin Android Player device and a stock Android emulator. Note that the values are incorrect on the former and correct on the latter.
We've confirmed the issue, but I'd like to get a sense of what kind of priority to consider this. It's our understanding that it's recommended these values aren't used, as they're often incorrect on some physical devices (see thread at: https://groups.google.com/forum/#!topic/android-developers/g56jV0Hora0).
Is the fact that these are incorrect especially blocking to what you want to do?
As there has been no activity on this bug, I'm going to close. As Will has said, these are values that Google do not recommend using.