×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    10

    Uncaught exception java/lang/NullPointerException.

    Hi All,

    i am new to J2ME. my requirement is to send a sms and i am successfull in that. but my problem is when i am sending a sms the mobile asks for permission to send the sms, if option selected is "YES" ok no problem but if he select "NO" i am getting the "Uncaught exception java/lang/NullPointerException." error and the application quits. please help me.

    Thanks in advance.

    regards
    Bapitha .N.C
    Last edited by bapithanc; 2008-06-23 at 09:03. Reason: to enable quick reply

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Uncaught exception java/lang/NullPointerException.

    Place the SMS message sending in try-catch block and catch al the potential exceptions (in this case Security Exception, which means that you should not try to send the message, but cancel the try...)
    Make also sure that you do not try to access any resources which is not initialized because the Seucrity Exception was thrown...

    Hartti

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    10

    Re: Uncaught exception java/lang/NullPointerException.

    Hi Hartti,

    thankx for your reply. but i did not understand what is potential exception. when i searched regarding it i got something saying Proactve exception. but i am not clear with. i am hereby attching the code below.

    try
    {
    msgSend msgsend = new msgSend( "+919945061658", "HELLO");
    new Thread(msgsend).start();
    throw new NullPointerException ( );
    }
    catch(NullPointerException e)
    { System.out.println("Error");
    }

    this works fine if i click yes when i proceed but if i click no then i get "Uncaught exception java/lang/NullPointerException."

    regards,
    Bapitha .N.C

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Uncaught exception java/lang/NullPointerException.

    You should not be throwing any exceptions yourself in this case.

    I think you should read this article about SMS sending
    http://developers.sun.com/mobility/midp/articles/wma/
    There is example code in there.

    Hartti

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    10

    Smile Re: Uncaught exception java/lang/NullPointerException.

    Thankx Hartti. it worked when i followed the link which u have send. thanks a lot again

    Bapitha .N.C

  6. #6
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    java/lang/NullPointerException.

    i am sending an sms through a midlet and i get the following error at runtime:

    java.lang.NullPointerException
    at javax.microedition.lcdui.Display.setCurrent(+15)
    at MoboPay.commandAction(+760)
    at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
    at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
    at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
    at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+186)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)

    plz help
    thanks

Similar Threads

  1. Replies: 3
    Last Post: 2011-03-25, 20:22
  2. s60 3rd ed emulator crash
    By Kimau in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2008-06-18, 22:12
  3. Replies: 2
    Last Post: 2007-09-18, 08:47
  4. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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