pixelDensity() in Android

edited May 2016 in Android Mode

is it me or is it that pixelDensity() is not available in Android Mode ?

Answers

  • edited May 2016

    @phoebus=== though there is a lot of time i dont use p5 for android it seems to me that the "standard" way for android native geting density can be used: DisplayMetrics metrics = getResources().getDisplayMetrics(); (that you must adapt for fragment:) this.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); then ask for what you want (width, height, density...) in this case: float SCREEN_DPI = metrics.densityDpi; note that this will return not the Real device density but one of the constant values used by android for classifying devices (160 = mdpi...)

Sign In or Register to comment.