Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Cel As Phone
Private imgRosso As ImageView
Private imgBlu As ImageView
Dim dpi As Float
Dim dpi2 As Float
Dim S As Float
Private img1 As ImageView
Private img2 As ImageView
Private img3 As ImageView
Private img4 As ImageView
Private img5 As ImageView
Private img6 As ImageView
Private img7 As ImageView
Private img8 As ImageView
Private img9 As ImageView
Private img10 As ImageView
Private img11 As ImageView
Private Panel1 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Cel.SetScreenOrientation(0)
S=GetDeviceLayoutValues.Scale ' find screen dpi
If S= 0.75 Then
dpi=120
Else If S= 1 Then
dpi=160
Else If S= 1.5 Then
dpi=240
Else If S=2 Then
dpi=320
End If
Dim Cm As Int
' dpi in 1 Cm. If in one inch (25.4 mm) I have 320 dpi, in 1 cm (10 mm) I will have the dpi obtained with the following formula:
Cm = dpi*10/25.4
' centimetri
img1.Left=0dip
img2.Left= Cm*1
img3.Left= Cm*2
img4.Left= Cm*3
img5.Left= Cm*4
img6.Left=Cm*5
img7.Left=Cm*6
img8.Left=Cm*7
img9.Left=Cm*8
img10.Left=Cm*9
img11.Left=Cm*10
End Sub