File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes displaying NIC address in MIDlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "displaying NIC address in MIDlet" Watch "displaying NIC address in MIDlet" New topic

displaying NIC address in MIDlet

pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
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

Anyone can help?
Jeff Jetton
Ranch Hand

Joined: Mar 29, 2005
Posts: 71
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.

- Jeff
I agree. Here's the link:
subject: displaying NIC address in MIDlet
It's not a secret anymore!