I have a function which uses a field in DisplayMetrics of Resources of Context class:
DisplayMetrics
Resources
Context