×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    10

    Application running in emulator but not when deployed to mobile

    I have developed an application for CLDC platform. It runs fine in an emulator but when deployed on my N70 it doesnt execute as expected. I will briefly describe the application- There are some 14 classes. Each class has a variable and 2 methods (actually deriving from a single base class). I create an instance of each of the class and add it to a vector. When i execute it in the emulator it runs fine, but when I deploy it to the device it stops the execution at the point where am creating these 14 instances and adding it to the vector. Is this creation of instances cause for the problem? Any one experienced the same problem before?

    Am using- Java ME SDK 3.0, using Netbeans IDE.

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    9

    Lightbulb Re: Application running in emulator but not when deployed to mobile

    Hello Sanaulla123.

    but when I deploy it to the device it stops the execution at the point where am creating these 14 instances
    Since you seem to be sure that the N70 fails on performing this operation,
    why not trying to catch this Exception and show it on the phone?

    Code:
    try
    {
        //here is where all 14 instances are being created
        methodThatCreatesAllInstances();
    }
    catch ( Throwable t )
    {
        //create a form that shows debug data
        Form f = new Form( "Throwable thrown" );
        f.append( t.toString()   );
        f.append( t.getMessage() );
                
        //show the form
        Display d = Display.getDisplay( myMidletInstance );
        d.setCurrent( f );
    }
    In case the function methodThatCreatesAllInstances() throws
    an exception, the class and message of this exception are displayed.

    Hope this helps you solving your problem

    Greetings

    jenetic

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    10

    Re: Application running in emulator but not when deployed to mobile

    Quote Originally Posted by jenetic View Post
    Hello Sanaulla123.

    Since you seem to be sure that the N70 fails on performing this operation,
    why not trying to catch this Exception and show it on the phone?

    Code:
    try
    {
        //here is where all 14 instances are being created
        methodThatCreatesAllInstances();
    }
    catch ( Throwable t )
    {
        //create a form that shows debug data
        Form f = new Form( "Throwable thrown" );
        f.append( t.toString()   );
        f.append( t.getMessage() );
                
        //show the form
        Display d = Display.getDisplay( myMidletInstance );
        d.setCurrent( f );
    }
    In case the function methodThatCreatesAllInstances() throws
    an exception, the class and message of this exception are displayed.

    jenetic
    Thanks a lot for the tip. I tried using a new form for printing exceptions. I put the code in try catch and when i got to the point where instances are created- there's no Exception form showing up. The application quits and comes out to the menu, but when i run the application again it starts from the state where it had quit- means if i was in the last form it will start execution from there. This problem am facing after I put the code in the try-catch block.

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Application running in emulator but not when deployed to mobile

    Can you reproduce your problem in the smallest possible example code, and post it here?

    It sounds like (at least in the second case) you are setting the current Displayable to null.

    Graham.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    10

    Re: Application running in emulator but not when deployed to mobile

    Quote Originally Posted by grahamhughes View Post
    Can you reproduce your problem in the smallest possible example code, and post it here?
    The sample code which is causing the problem is:
    Code:
    try {
                        Disease severeP = new SeverePneumonia();
                        Disease severeDehy = new SevereDehydration();
                        Disease severePDehy = new SeverePersistantDiarrhoea();
                        Disease verySevereFeb = new VerySevereFebrile();
                        Disease sCMeaseles = new SevereComplicatedMeaseles();
                        Disease mast = new Mastoiditis();
                        Disease sMal = new SevereMalnutrition();
                        Disease anaemia = new Anaemia();
                        Disease pneu = new Pneumonia();
                        Disease someDehy = new SomeDehydration();
                        Disease persistentD = new PersistentDiarrhoea();
                        Disease dy = new Dysentery();
                        Disease mala = new Malaria();
                        Disease mEyeMouth = new MeaslesEyeMouth();
                        Disease aEar = new AcuteEarInfection();
                        Disease vLowWeight = new VeryLowWeight();
                        Disease cEar = new ChronicEarInfection();
    
                        diseaseList.addElement(severeP);
                        diseaseList.addElement(severeDehy);
                        diseaseList.addElement(severePDehy);
                        diseaseList.addElement(verySevereFeb);
                        diseaseList.addElement(sCMeaseles);
                        diseaseList.addElement(mast);
                        diseaseList.addElement(sMal);
    
                        diseaseList.addElement(anaemia);
                        diseaseList.addElement(pneu);
                        diseaseList.addElement(someDehy);
                        diseaseList.addElement(persistentD);
                        
                        //There are 10 more such instances being added
                        diagnose();
                    } catch (Throwable t) {
                        switchDisplayable(null, exceptionForm);
                        exceptionMsgItem.setText(t.getMessage());
                        exceptionNameItem.setText(t.toString());
                    }
    The diagnose() method just loops through the list to check for various dieases.

    It sounds like (at least in the second case) you are setting the current Displayable to null.
    Am setting the current Displayable to a new form.

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Application running in emulator but not when deployed to mobile

    If you remove the contents of the try{} block, does the problem go away?

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    10

    Re: Application running in emulator but not when deployed to mobile

    Quote Originally Posted by grahamhughes View Post
    If you remove the contents of the try{} block, does the problem go away?
    Yeah exactly, the problem goes away.

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Application running in emulator but not when deployed to mobile

    OK... what if you just comment-out the "diagnose()" call?

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    10

    Unhappy Re: Application running in emulator but not when deployed to mobile

    Quote Originally Posted by grahamhughes View Post
    OK... what if you just comment-out the "diagnose()" call?
    I tried all the ways. At last resorted to using methods in place of classes. That seem to be working fine. I see the problem in creating 14 instances of 14 different classes and adding it to a vector.

    Using methods is a really inflexible approach, but cant help

    Thanks a lot for the help provided. Though it helped me to realise that no memory allocation ought to be done in the constructor or the start method

Similar Threads

  1. Replies: 0
    Last Post: 2009-11-22, 19:03
  2. Replies: 9
    Last Post: 2009-10-08, 11:54
  3. Not able to install application in mobile.
    By SymbianTH in forum Symbian
    Replies: 2
    Last Post: 2009-10-08, 11:34
  4. Quieries abt the application running on mobile
    By nokia86shankar in forum Mobile Java General
    Replies: 1
    Last Post: 2009-09-23, 11:15
  5. Mobile Application Journey planner
    By henixy2k2 in forum Mobile Java General
    Replies: 7
    Last Post: 2009-07-21, 10:59

Posting Permissions

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