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
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Does anyone know Method.java replacement for BlacBerry API??

Purpose:

Create RFCOMM socket for a bluetooth device.

 

Problem:

Does anyone know Method.java replacement for BlacBerry API??

or

Does anyone know how to create RFCOMM socket for a bluetooth device??

 

Code:

Method m = info.getClass().getMethod("createRfcommSocket", new Class[] { int.class });

sock = (BluetoothSocket) m.invoke(info, Integer.valueOf(1));

 

 

 

Thanks your attention,

 

 

-Fight with BB10
Contributor
Posts: 43
Registered: ‎11-30-2011
My Device: Dev Alpha, 8520
My Carrier: Vodafone

Re: Does anyone know Method.java replacement for BlacBerry API??

There's little to no reflection support in BlackBerry Java.

 

And as far as RFComm connection goes, are you trying to do OBEX transfers? RIM has a low level api for that.



I've got 99 problems and eclipse is all of them


Twitter

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Does anyone know Method.java replacement for BlacBerry API??

little is a bit overstressed, reflection is part of the desktop java api, bb java is based on j2me which does not have reflection.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Contributor
Posts: 43
Registered: ‎11-30-2011
My Device: Dev Alpha, 8520
My Carrier: Vodafone

Re: Does anyone know Method.java replacement for BlacBerry API??


simon_hain wrote:
little is a bit overstressed, reflection is part of the desktop java api, bb java is based on j2me which does not have reflection.

I said "little" because of Class.forName(className), which (sort of) counts as reflection? I dunno, I've kind of used it to do something which was done by reflection in some other code. But yeah you're right, full on reflection (java.lang.reflect) isn't possible, especially for what lyon819 is trying to do.



I've got 99 problems and eclipse is all of them


Twitter