Android Question Int To DIP


Well-Known Member
Licensed User
this simple operation generates an error in the compilation
 LS1.Padding=Array (6.7%x ,0dip,0dip,0dip) [\CODE]

in the forum I found this solution
Sub IntToDIP(Integer As Int) As Int 
   Dim DIP As Int
   DIP = Integer * 1dip
   Return DIP
End Sub


Well-Known Member
Licensed User
this is error in the compilation

javac 1.8.0_131
src\com\iliad\gilo\ error: incompatible types: Object[] cannot be converted to int[]
parent.mostCurrent._ls1.setPadding((int[])(new Object[]{(Object)(_inttodip(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (4),mostCurrent.activityBA))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)))}));


Well-Known Member
Licensed User
To have greater precision and avoid the rounding of 1Dip, Erel suggested to work 100dip / 100.
Whilst down in the mud of pedant detail here...

Since DIP's are defined as 160 per inch, I've been using 160DIP / 160 as the conversion factor, which likely cancels out an integer rounding based on the DIP suffix probably being equivalent to the integer operations: * DevicePPI / 160.

On the one hand, we're only talking about being one pixel out; on the other hand, sometimes one pixel errors stand out like a star in the night sky, especially if there's a line of them.