×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jul 2010
    Posts
    54

    NullPointerException!!!!!

    When my app throws an exception on the S60 emulator, it looks like this:

    java.lang.NullPointerException
    - BurningTrain.ToTest(), bci=15
    - JD1.keyPressed(), bci=201
    - javax.microedition.lcdui.Canvas.handleEvent(), bci=105
    - javax.microedition.lcdui.Toolkit.handleDisplayableEvent(), bci=12
    - com.symbian.lcdjava.lang.SystemExtensions._runNextCallback(), bci=0
    - com.symbian.lcdjava.lang.SystemExtensions.dispatchCallbacks(), bci=8
    - com.symbian.midp.runtime.KVMEventProcessor.run(), bci=4

    can anybody know what is bci mean? how it help in finding the error?

    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: NullPointerException!!!!!

    What about the Sun Java WTK?
    With which method call does this exception was thrown, try to find out the exactl line of the cause by putting the println statements.
    May be this is thrown by the Symbain OS.Make above the above two point as confirmed.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Jul 2010
    Posts
    54

    Re: NullPointerException!!!!!

    I am using two canvas. Firstly when application pause then it is shifting to second canvas and this exception occurs when it come back to first canvas.
    This exception occur after this statement-
    display.setCurrent(main);
    where main is the object of first canvas.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: NullPointerException!!!!!

    Are you sure that the main is not null?
    Have you initealized this object in the second Canvas where you are setting the line display.setCurrent(main);?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Jul 2010
    Posts
    54

    Re: NullPointerException!!!!!

    Quote Originally Posted by raj_J2ME View Post
    Are you sure that the main is not null?
    Have you initealized this object in the second Canvas where you are setting the line display.setCurrent(main);?
    No, main is the first canvas object which starts first, it cannot be null.
    Actually i m getting this exception in switching the display between two canvases either frm first to second or second to first.

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: NullPointerException!!!!!

    That’s what I am saying, when you are setting the First Canvas as the displayable inside the Second Canvas, the object of the First Canvas main must not be null.

    When you are writing the line displayeObject.setCurrent(Main), check the main is not null,
    Also check the display object is also not null.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor
    Join Date
    Jul 2010
    Posts
    54

    Re: NullPointerException!!!!!

    Thanks for reply,
    I put this statement in try catch statement like this-
    try {
    if(main!=null)
    display.setCurrent(main);
    }catch(Exception e) {
    e.printStackTrace();
    System.out.println("Exception1 : "+e);}

    and getting the exception-
    java.lang.NullPointerException
    - BurningTrain.ToTest(), bci=15
    - JD1.keyPressed(), bci=204
    - javax.microedition.lcdui.Canvas.handleEvent(), bci=105
    - javax.microedition.lcdui.Toolkit.handleDisplayableEvent(), bci=12
    - com.symbian.lcdjava.lang.SystemExtensions._runNextCallback(), bci=0
    - com.symbian.lcdjava.lang.SystemExtensions.dispatchCallbacks(), bci=8
    - com.symbian.midp.runtime.KVMEventProcessor.run(), bci=4
    Exception1 : java.lang.NullPointerException

    And i am getting same error while trying this-
    try {
    main2=new JD1(this);
    display.setCurrent(main2);
    }
    catch(Exception e) {
    e.printStackTrace();
    System.out.println("Exception1 : "+e);}
    where main2 is object of second canvas.

  8. #8
    Registered User
    Join Date
    Jan 2009
    Location
    Bangalore, India
    Posts
    116

    Re: NullPointerException!!!!!

    AFAIK... if the displayable is null and its being set by settCurrent method, app shouldn't crash throwing null pointer exception rather app should display nothing (a black screen) or simply sit in background (depending on the device). I think when you switch between the two canvases, there might be something else is null. You need to debug your code thoroughly to figure out the problem

    Thanks,
    Somendra

Similar Threads

  1. NullPointerException
    By briandaly40 in forum Mobile Java General
    Replies: 4
    Last Post: 2012-03-12, 06:51
  2. NullPointerException
    By sloban in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2004-11-18, 10:23
  3. NullPointerException
    By mshita in forum Mobile Java General
    Replies: 2
    Last Post: 2004-07-30, 23:33
  4. NullPointerException
    By cwfvanoordt in forum Mobile Java General
    Replies: 1
    Last Post: 2003-11-14, 20:20
  5. NullPointerException
    By kiranputhran in forum Mobile Java General
    Replies: 1
    Last Post: 2003-02-17, 07:17

Posting Permissions

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