How to create UUID from string in android

后端 未结 6 1256
Happy的楠姐
Happy的楠姐 2020-12-29 01:53

In my app, I scan low energy Bluetooth for specific service uuid 2415. To convert the string 2415 into uuid I am using UUID serviceUUID = UUID.fromString(

6条回答
  •  不知归路
    2020-12-29 02:04

    you can use

    String str = "1234";
    UUID uuid = UUID.nameUUIDFromBytes(str.getBytes());
    
    System.out.print(uuid.toString());
    

提交回复
热议问题