Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

how to convert String to UUID??

Problem:

I could not get UUID from a String.

 

Purpose:

Connect to a bluetooth device by the following code

_bluetoothConnection = (StreamConnection) Connector.open(_url);

 

Sample code:

String _uuid = "00001101-0000-1000-8000-00805F9B34FB";

?? UUID = _uuid??

DiscoveryAgent mDiscoveryAgent = LocalDevice.getLocalDevice().getDiscoveryAgent();
String url = mDiscoveryAgent.selectService(_uuid,ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
_bluetoothConnection = (StreamConnection) Connector.open(_url);

 

Does anyone know how to get UUID from a String?

 

Thanks your attention,

 

-Fight with BB10
Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: how to convert String to UUID??

 

String _uuid = "00001101-0000-1000-8000-00805F9B34FB";

int uuidint = _uuid.hashCode();

UUID deviceu = new UUID(uuidint);

 

Cheers,

 

-Fight with BB10
Please use plain text.