I am using a Android Phone to communicate with a BLE device.
The method to send data for the library needs byte[], sharing one of the static example snippet:
public static final byte dataRequest[] = { 0x23, 0x57, 0x09, 0x03, (byte) 0xD4};
sendDataToDevice(dataRequest);
The data i am receiving from the user is in String, for example
String str1 = "D4";
now my question is , how to convert this String value (which is actually a hex value in String datatype) to byte, so that i can store these dynamic String values and convert and then insert it into byte[] like ,
byte[0] = convertToByte(str1);
where byte[0] must store value as 0xD9 or like the format given in static example.