#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Private Answer As Long
Private textOPDecimal As TextArea
Private txtInputHex As TextArea
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
End Sub
Sub Button1_Click
If txtInputHex.Text = "" Then
textOPDecimal.Text = 0/0
Return
End If
Answer = HexToInt(txtInputHex.Text)
textOPDecimal.Text = Answer
End Sub
Private Sub HexToInt(hexStr As String) As Long
Dim bc As ByteConverter
Dim RegionUsed As Long
Dim tempStr As String
Dim tempByte(8) As Byte
tempStr = hexStr.ToUpperCase
bc.LittleEndian = False
tempByte = bc.StringToBytes(tempStr, "UTF8")
RegionUsed = Bit.ParseLong(bc.StringFromBytes(tempByte, "UTF8"), 32)
' RegionUsed = Bit.ParseLong(tempStr, 32)
Return RegionUsed
End Sub