Results 1 to 7 of 7
  1. #1
    arc_remiel is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default help guys on java me

    so i get this problem when I try to call a class from a method..

    TRACE: <at java.lang.NullPointerException: 0>, Exception caught in Display class
    java.lang.NullPointerException: 0
    at luckynine.StageOne1.keyPressed(StageOne1.java:1394 )
    at javax.microedition.lcdui.CanvasLFImpl.uCallKeyPres sed(), bci=19
    at javax.microedition.lcdui.DisplayableLFImpl.uCallKe yEvent(), bci=146
    at javax.microedition.lcdui.Display$DisplayEventConsu merImpl.handleKeyEvent(), bci=30
    at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
    at com.sun.midp.events.EventQueue.run(), bci=179
    at java.lang.Thread.run(Thread.java:662)
    javacall_lifecycle_state_changed() lifecycle: event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWNstatus is JAVACALL_OK

  2. #2
    arc_remiel is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    the condition is like this

    if(score == 2) {
    main.singleTwo();
    }

    when the score reaches 2..it would call the method that will call another class..
    or are there any other way around this..thanks iin advance

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    In your file StageOne1, method keyPressed, line 1394 (good heavens!) something was null and it shouldn't have been.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    arc_remiel is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    how do you think i could fix that?..sorry i'm just starting to get a hand on java me..thank for the help

  5. #5
    arc_remiel is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    o yeah..that line number is pertaining to the method that i just posted before..
    but it isn't null..but why does it keep telling that its null?

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by arc_remiel View Post
    o yeah..that line number is pertaining to the method that i just posted before..
    but it isn't null..but why does it keep telling that its null?
    Because it is null; the jvm is way too stupid to lie to you. If you don't believe it print out all the objects that can possibly be null just before the line where the Exception is thrown.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    arc_remiel is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    now that you mention it..

    public void singleTwo() {

    try {
    SingleTwo sT = new SingleTwo(this);
    //ng.start();
    display.setCurrent(sT);
    } catch (Exception ex) {
    System.out.println(ex);
    }

    heres the code in the main midlet..
    it then tries to display the canvas of the class SingleTwo..i still don't get..but i'll try to reflect upon what you have just said and find what null value is it talking about..thanks again..

Similar Threads

  1. please guys , help me in the good book for core java
    By funkygarzon in forum New To Java
    Replies: 49
    Last Post: 01-28-2011, 02:30 AM
  2. hi guys help me in math.random () in java
    By funkygarzon in forum New To Java
    Replies: 5
    Last Post: 08-09-2010, 04:48 AM
  3. hi guys
    By pvsnmurthy in forum Introductions
    Replies: 0
    Last Post: 04-16-2009, 08:37 AM
  4. Cheers to Java Guys
    By right2001 in forum Introductions
    Replies: 0
    Last Post: 02-16-2009, 03:10 AM
  5. Replies: 2
    Last Post: 10-13-2008, 05:01 AM

Posting Permissions

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