Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Iran - Tabriz

    probleam with getDiscoveryAgent()

    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 :
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
    import java.util.Vector;
    import java.io.*;
    import javax.bluetooth.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
     * @author mahdi
    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);
        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) {
            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 ?

  2. #2
    Registered User
    Join Date
    Sep 2007

    Re: probleam with getDiscoveryAgent()

    Hi mahdi68,

    Null pointer exception is coming bcoz in the doDeviceDiscovery() method when you call LocalDevice.getLocalDevice(); you got the exception it is caught in the catch block and the next statement is operatening on the local varibale which is not initilized .

    For more in formation on the bluetooth example please refer the forum nokia wiki

Similar Threads

  1. probleam in TimerTask
    By mahdi68 in forum Mobile Java General
    Replies: 8
    Last Post: 2009-11-07, 19:21
  2. probleam in show splash screen
    By mahdi68 in forum Mobile Java General
    Replies: 19
    Last Post: 2009-10-04, 17:23
  3. probleam related to certificate key
    By deepakk in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 2
    Last Post: 2008-04-04, 14:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts