×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    java me canvas based calendar UNHANDLED EXCEPTION

    hi
    i was trying the canvas based date picker code and every time i try to run it i get an unhandled exception !

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

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Quote Originally Posted by youssef.lahoud View Post
    hi
    i was trying the canvas based date picker code and every time i try to run it i get an unhandled exception !
    Welcome to the forum nokia Discussion boards.
    we will appreciate of you could come with the more information about your issue.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Try the code example at Forum Nokia wiki:

    http://wiki.forum.nokia.com/index.ph...ar/date_picker

    thanks,
    ~Amitabh

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    I'm using netbeans, i copied the code of the 'Java ME Canvas based calendar/date picker' and when i try to run, the emulator displays 'unhandled exception! close the application?'
    i've created two classes of type 'MIDP Canvas' and copy-pasted the provided source code

    it's my first time with JAVA ME if you can help i'd be grateful
    thanks

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Try the code as is, or cut paste your code here for debuging...

    Put some try/catch to see where this exception is coming from and why

    thanks,
    ~Amitabh

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

    Thumbs up Re: java me canvas based calendar UNHANDLED EXCEPTION

    well are you just taking about the code that im2amit is talking about?
    have you created the project and the MIDlet too in order to run the Java ME project?

    I guess the code that im2amit has given is the perfect one and it must work.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    on the bottom of this page http://wiki.forum.nokia.com/index.ph...ar/date_picker i downloaded the source code, then i created a project in netbeans 'MIDP Application' then 2 classes of type 'MIDP Canvas', i named them 'CalendarCanvas' and 'CalendarWidget' and pasted the code as it is, netbeans reported no exception, only when i run, the emulator displays the unhandled exeption.
    if the code is working fine with you plz guide me through the steps you followed to create and run the project.

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

    Thumbs up Re: java me canvas based calendar UNHANDLED EXCEPTION

    I guess that you are not creating the class MIDlet ?
    Are you?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  9. #9
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    No :S i just created the two classes i stated before 'MIDP Canvas', what code should i provide in the class MIDlet ?
    i'm really sry i've never worked with JAVA ME and i have this project to submit.
    thanks

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

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Quote Originally Posted by youssef.lahoud View Post
    No :S i just created the two classes i stated before 'MIDP Canvas', what code should i provide in the class MIDlet ?
    i'm really sry I've never worked with JAVA ME and i have this project to submit.
    thanks
    Need not be sorry about this..it happens you start anything...just dare to do the things..

    Well, you do one thing create the java file, let say FirstMIDlet as the type of MIDlet if you are using netbeans IDE. Then you will see three methods in that java file called startApp(),pauseApp(), destroyApp() are even the commandAction()..

    Then you create the object of the CalendarCanvas in the constructor of the midlet and in the startApp() just set the created object as the displayable, like this...
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class GIFDemo extends MIDlet {

    private boolean boolMotion=false;
    private int iX=10,iY=60;

    Display mDisplay;
    Thread th;

    public void destroyApp(boolean unconditional){}

    public void pauseApp() {}

    public void startApp() {
    mDisplay = Display.getDisplay(this);

    final MyCanvas can = new MyCanvas();

    mDisplay.setCurrent(can);
    }

    }
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    I created a third class of type MIDlet and i provided the following code, but when i run i'm still getting an unhandled exception error


    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    /**
    * @author Owner
    */
    public class GIFDemo extends MIDlet {


    Display mDisplay;



    public void startApp() {
    mDisplay = Display.getDisplay(this);
    final CalendarCanvas can = new CalendarCanvas(this);
    mDisplay.setCurrent(can);

    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    }

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

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Hi,
    On which line the exception was occurred?
    Are you able to see something on the screen?
    try to find the line of exception..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    The emulator does not specify the line on which the error occurred it just displays 'Unhandled Exception! close application?'

    I did not add anything to the code, so i guess it should work fine :S
    thanks

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

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    Quote Originally Posted by youssef.lahoud View Post
    The emulator does not specify the line on which the error occurred it just displays 'Unhandled Exception! close application?'

    I did not add anything to the code, so i guess it should work fine :S
    thanks
    That's actually my fault...I should have been explained to you this thing before,

    Put the system.out.println("1") after the every line in the java file.Then execute the projct, the system.out.println("1") will come before the line which is just throwing the exception and is the root cause for the same..

    On which emulator are you trying to run the project.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  15. #15
    Registered User
    Join Date
    Apr 2010
    Posts
    9

    Re: java me canvas based calendar UNHANDLED EXCEPTION

    the thing is that as soon as the compiler connects with the agent the emulator displays the error, i tried the System.out.println... in the constructor of the CalendarCanvas and at the beginning of the startApp() method of the MIDlet and none of them had an effect. So i think the problem lies somewhere outside the code.
    thanks

Similar Threads

  1. Canvas based Application
    By kemmal in forum Mobile Java General
    Replies: 5
    Last Post: 2010-02-28, 19:17
  2. s60 3rd ed emulator crash
    By Kimau in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2008-06-18, 22:12
  3. Unhandled exception at
    By phoneynk in forum Symbian
    Replies: 2
    Last Post: 2007-03-12, 15:48
  4. Major problem with delegation to Canvas
    By bartekn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2003-10-08, 17:46
  5. Accessing network info from Java and location based info in Australia
    By T-Funk in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-12-09, 09: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
  •  
×