Type | function |
Library | device.* |
Return value | nil |
Keywords | refresh, dpi, xdpi, ydpi, orientation |
See also | Sample code, orientation, xdpi, ydpi |
This function refreshes the xdpi and ydpi for the device, based on the orientation. Orientation changes may result in dpi changes if the display is stretched.
device.refreshDpi()
local device = require 'plugin.device'
print(device.orientation, device.xdpi, device.ydpi)
local function onOrientationChanged(event)
device.refreshDpi()
print(device.orientation, device.xdpi, device.ydpi)
end
Runtime:addEventListener("orientation", onOrientationChanged)