Android Question java.lang.NumberFormatException: Invalid hex double:0x456

Discussion in 'Android Questions' started by fifiddu70, Jul 22, 2018.

  1. fifiddu70

    fifiddu70 Well-Known Member Licensed User

    hello, i need to use two edittext for insert vendor id and product id of the my print in my code, when the read vid and pid from edittext i have this error: java.lang.NumberFormatException: Invalid hex double:0x456
    0x456 is vendor id.
    how to resolve?
     
  2. Sandman

    Sandman Well-Known Member Licensed User

    You might need to pad the number to make it more parseable:

    0x0456
     
  3. fifiddu70

    fifiddu70 Well-Known Member Licensed User

    how to convert make the vendor id code read from an edittext and from another edittext the thermal printer product id? at the moment it works well only by entering the code directly as an example:
    Code:
    usb1.SetCustomDevice (usb1.DRIVER_SILABS, 0x4560x808)
    if I insert the two edittex instead:
    Code:
    Code:
    usb1.SetCustomDevice (usb1.DRIVER_SILABS, txtvendorid.text, txtpruductid.text)
    in this way I receive the error:
    java.lang.NumberFormatException: Invalid hex double: 0x456
    what can you do to make it read correctly by the two edittext?
     
  4. LucaMs

    LucaMs Expert Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice