×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Unhappy HELP! strange problem when sent background midlet to foreground.

    hi all.
    from the doucment . i got know the method Display.setCurrent( nonNullDIsplayable) can send a background midlet to foreground . but in my practice .it didn't work well . what happend like this :
    there is one backgroud thread hold a tcp connection in my midlet .there is two type msg come in . one is Type A .and another is B.
    when my midlet rcv the Type A msg, it excute <code>Display.setCurrent( Form a )</code> .and when the Type B msg come .the midlet will excute <code>Display.setCurrent( Form b )</code>.

    the problem is :
    when two type A msg come in .then double excute the <code>Display.setCurrent( Form a )</code> . the midlet will be sent to the forground .
    But when type B msg come in the .<code>Display.setCurrent( Form b )</code> is excuted . the midlet always in the background ..not sent to the foreground .


    and after i do some search on this topic . i got know the AMS will not invoke the Midlet . pauseApp() .except added a jad property like : nokia-back-event: pause . so i follow the doucument 's guard . add this property in the jad .and try to use the method <code> midlet.resumeRequest()</code> to take the backgound midlet to forground .

    but what happed let me sad .it's true the AMS invoke the pauseApp() and also invoke the s midlet.startApp() after excute the <code> midlet.resumeRequest()</code> .but the midlet always stay in background . and then i switch the backgroud midlet to the foreground by manually . i found the AMS don't invock the midlet.startApp() when foreground the midlet

  2. #2
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: HELP! strange problem when sent background midlet to foreground.

    Hello,
    I think some important information is missing.

    1. Please let us know what phone model you are using
    2. Please include some relevant code of the startapp and pauseapp to check
    :Ruben

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Re: HELP! strange problem when sent background midlet to foreground.

    Quote Originally Posted by rdrincon View Post
    Hello,
    I think some important information is missing.

    1. Please let us know what phone model you are using
    2. Please include some relevant code of the startapp and pauseapp to check
    -----------------------------------------------------
    all i test it on the s60_3thd_FP2_sdk simulator .

    the code like this :

    int midletState = 0;
    startapp()
    {
    if(MainForm == null)
    {
    MainForm = new MainForm ()
    Display.setCurrent(MainForm);
    }else
    {
    /* do nothing here . when the midlet go background .
    when the Thread rcv msg .it will try to display another screen .

    */

    }



    midletState = STATE_START;
    }


    pauseapp()
    {
    /* i just record the midlet's state .
    off course it will in itselt place
    when jad property <Nokia-midlet-background : pause> added
    */
    midletState = STATE_PAUSE;

    }
    }


    there is background thread also

    class thread
    {

    public void run()
    {
    msg = getMsgfromTcp();

    if(msg == Type A)
    {
    Display.setCurrent(screen A);
    }else if(msg == Type B)
    {
    Display.setCurrent(screen b);
    }

    }

    }

  4. #4
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: HELP! strange problem when sent background midlet to foreground.

    try changing your startApp() with this one

    PHP Code:
    startapp()
    {
    if(
    MainForm == null)
    {
    MainForm = new MainForm ()
    Display.setCurrent(MainForm);
    }else
    {
    /* do nothing here . when the midlet go background .
    when the Thread rcv msg .it will try to display another screen .

    */
    Display.setCurrent(null);
    }



    midletState STATE_START;

    Regards,
    Saurabh

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Re: HELP! strange problem when sent background midlet to foreground.

    Quote Originally Posted by ingsaurabh View Post
    try changing your startApp() with this one

    PHP Code:
    startapp()
    {
    if(
    MainForm == null)
    {
    MainForm = new MainForm ()
    Display.setCurrent(MainForm);
    }else
    {
    /* do nothing here . when the midlet go background .
    when the Thread rcv msg .it will try to display another screen .

    */
    Display.setCurrent(null);
    }



    midletState STATE_START;

    the result no change . can't pop up the screen autoly .but i got the something new that it can pop up the screen from background at first time run after installed to the emulater .

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Re: HELP! strange problem when sent background midlet to foreground.

    OH .sorry ..MY midlet is base on the j2mepolish .so maybe it's the polish's problem .

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Re: HELP! strange problem when sent background midlet to foreground.

    ok .problem is over .it's the polish' problem .thx all .

Similar Threads

  1. Problem with autostart in background
    By schnesim in forum Symbian
    Replies: 3
    Last Post: 2008-07-28, 11:18
  2. j2me Midlet Verification/Validation Problem
    By Nikolaos in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2008-06-16, 16:31
  3. Replies: 1
    Last Post: 2008-06-14, 14:42
  4. Program background / foreground
    By jackxie in forum Mobile Java General
    Replies: 1
    Last Post: 2006-07-13, 18:36
  5. launching MIDlet from another MIDlet on 6310i problem
    By niko86 in forum Mobile Java General
    Replies: 1
    Last Post: 2002-08-07, 09:38

Posting Permissions

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