This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've just started developing bluetooth in MIDlet,for my first application I create a MIDlet which able to display NIC address from bluetooth or remote device, when i run it it didn't display anything This is how the code look's like
I've never done any bluetooth coding, and I don't know a whole heckuva lot about it. But since no one has answered so far, I'll give it a shot...
I see that you're calling retrieveDevices() on your DiscoveryAgent object, which (as I understand it) should list devices that have already been discovered, or are somehow already known about, right? But you're never telling your DiscoveryAgent to go and look for new devices, and that's what the midlet is "listening" for.
So try putting this in there somewhere (like after "d.setCurrent(l);"):
Maybe that will work?
Now I have a question for you! I see that the midlet has to implement a listener interface. At what point in your code does your midlet register itself with (or "subscribe to") the DiscoveryAgent you create?
Usually, with other Java "listeners", you have to tell the thing you're listening to that you exist, so it will know to notify you when appropriate. For example, we use setCommandListener() on Displayable objects, and addRecordListener() on RecordStore objects. But your code doesn't do anything like that. And none of the Bluetooth code examples I've found in the Internet do that either.
So how does the DiscoveryAgent object know anything about your class? Is that somehow built-in to the LocalDevice object? (But if so, how?) It's all very strange.