Android Question Hex to decimal?

DaOne

Member
Licensed User
Longtime User
I have a string that contains a 2 digit hex value such as "1A" or "AF". I need to convert this to an integer (The decimal equivalent). Is there an easy way to do this?
 

DaOne

Member
Licensed User
Longtime User
Ok I think I am lost. Maybe you can help? I am inputting a value from 00 to FF from a string. No matter what I do when tying to convert this I get a force close. Here is my code.

B4X:
Dim i As Int
i = Bit.ParseInt("DataIn(4)", 4)
Toast.Show(i,True)
 
Upvote 0

kaudie

Member
Licensed User
Longtime User
Why do I get an error when I try this?

Dim Str_HexNumber As String
Str_HexNumber = "DA2DDE56"
Dim Int_Number As Int
Int_Number = Bit.ParseInt(Str_HexNumber, 16)

The error is:
java.lang.NumberFormatException: Invalid int: "DA2DDE56"

thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
1. This is an old thread. Create a new one.
2. Dont make dublicate posts
 
Last edited:
Upvote 0
Top