I have been trying to progress with the screen rotation and I am looking at this example from pyjnius:
from jnius import autoclass
DisplayMetrics = autoclass('android.util.DisplayMetrics')
metrics = DisplayMetrics()
print 'DPI', metrics.getDeviceDensity()
but the getDeviceDensity() doesn't exist. Is it src/src/org/renpy/android/Hardware.java dependent?>>> print 'DPI', metrics.getDeviceDensity()
DPITraceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'android.util.DisplayMetrics' object has no attribute 'getDeviceDensity'
any of these:
>>> dir(metrics)
['DENSITY_DEFAULT', 'DENSITY_DEFAULT_SCALE', 'DENSITY_DEVICE', 'DENSITY_HIGH', 'DENSITY_LOW', 'DENSITY_MEDIUM', 'DENSITY_TV', 'DENSITY_XHIGH', 'DENSITY_XXHIGH', '__class__', '__cls_storage', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__javaclass__', '__javaconstructor__', '__module__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'density', 'densityDpi', 'equals', 'getClass', 'hashCode', 'heightPixels', 'noncompatDensity', 'noncompatDensityDpi', 'noncompatHeightPixels', 'noncompatScaledDensity', 'noncompatWidthPixels', 'noncompatXdpi', 'noncompatYdpi', 'notify', 'notifyAll', 'scaledDensity', 'setTo', 'setToDefaults', 'toString', 'wait', 'widthPixels', 'xdpi', 'ydpi']
just return 0 :
>>> metrics.xdpi
0.0
>>> metrics.density
0.0
I have been trying to get screen layout without the event yet, just like this:
Configuration = autoclass('android.content.res.Configuration')
Configuration().orientation
but again, it always returns zeros...?
What am i doing wrong?
thank you
Petr