views:

12

answers:

0

Hi i want to use mobile device bluetooth , i use this code but there is probleam with this method getDiscoveryAgent() . this error shown :

Null pointer java/lang/nullpointer exeption

this is my code

public class Midlet extends MIDlet implements CommandListener {

LocalDevice local = null;
DiscoveryAgent agent = null;
List activeDevices = new List("Active Devices", List.IMPLICIT);
Display display;

public void startApp() {
    display = Display.getDisplay(this);
    doDeviceDiscovery();
    display.setCurrent(activeDevices);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable d) {
}

public void doDeviceDiscovery() {
    try {
        local = LocalDevice.getLocalDevice();
    } catch (BluetoothStateException ex) {
        ex.printStackTrace();
    }
    agent = local.getDiscoveryAgent();
}

}

and this is out put on netbeans :

Smart card communication error 0x80100017 The specified reader is not currently available for use Using Untrusted simulated domain "Series 40 5th Edition SDK, Feature Pack 1" Instance #6500500 Ready for Future Connections "Series 40 5th Edition SDK, Feature Pack 1" Connection Terminated

can any body help me ? thanks