如何使用标准的 UUID 格式

How to use standard UUID format

为什么我在 logcat 输出中收到如下所示的 UUID 格式?在阅读了 UUID 之后,我希望格式如下

de305d54-75b4-431b-adb2-eb6b9e546014

我为获取 UUID 而编写的代码是:

case BluetoothDevice.ACTION_UUID:
        Log.w(TAG, SubTag.msg("BluetoothDevice.ACTION_UUID"));

        Parcelable[] extraUUID = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);

        if (extraUUID.length > 0) {
            Log.i(getClass().getSimpleName(), SubTag.msg("onReceive", "extraUUID: "+extraUUID.toString()));
        }

        break;

Logcat

09-18 11:35:51.622: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:51.622: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@2e610c87
09-18 11:35:54.472: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:54.482: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@36a16fdd
09-18 11:35:54.862: W/BT_Receiver(8608): >>[BluetoothDevice.ACTION_UUID()]<<
09-18 11:35:54.862: I/BT_Receiver(8608): [onReceive()]-> extraUUID: [Landroid.os.Parcelable;@34378b20
Landroid.os.Parcelable;@2e610c87

Parcelable[].toString()的表示。您可能想在数组上循环并调用 toString() 到索引处的元素。例如

for (Parcelable p : extraUUID) {
     Log.i(getClass().getSimpleName(), SubTag.msg("onReceive", "extraUUID: "+p.toString()))
}