×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    9

    Minimize J2ME application in LWUIT

    Hello friends
    I am using lwuit for UI. I want to minimize the application. for that i have written following code.
    Code:
    public void pauseApp() {
            javax.microedition.lcdui.Display.getDisplay(this).setCurrent(null);
        }
    Its works fine when minimize command is on left soft key. but when it listed in menu on right soft key its not working. as its minimizing application but its automatically re invoking. also i want to mention few things,
    - Form creation and display logic is in separate classes and its controlled in midlet
    - each form is implementing action listener and focus listener

    And same code is working in the LWUIT demo application.
    F1.

    Regards
    sohil

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

    Re: Minimize J2ME application in LWUIT

    What does your focusListener code do if the component loses focus? Does it set focus to something? I'm guessing it will lose focus when the application itself loses focus. The focusListener code may be causing the appliction to put itself back in the foreground (by issuing a Display.setCurrent()).

    Graham.

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    9

    Re: Minimize J2ME application in LWUIT

    Hi Graham

    I removed the focus listener code but still no change. its auto invoking the application.
    On focus gain i am adding commands dynamically and on lost focus removing some commands.
    i tried another code where midlet implements the focus listener. Form and component creation in same midlet. then its working fine. is my code structure is wrong ?

    Thanks
    Sohil

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

    Re: Minimize J2ME application in LWUIT

    I don't know.

    I can only think that something inside the LWUIT code is calling Display.setCurrent(), and that you are (unwittingly) causing that to happen. When you setCurrent(null) on a Series 60, the Canvas's hideNotify() method will be called. LWUIT will be handling that event, and presumably calling some code of yours. I'm not sufficiently familiar with LWUIT to tell you what it's doing.

    Graham.

    Graham.

  5. #5
    Registered User
    Join Date
    Jul 2009
    Posts
    9

    Re: Minimize J2ME application in LWUIT

    Thanks for your quick reply.I have done some work out on your comments and find some solution. see the following code.

    Code:
     public void pauseApp() {        
            Timer t = new Timer();
            TimerTask t1 = new TimerTask() {
                public void run() {
                    javax.microedition.lcdui.Display.getDisplay(this).setCurrent(null);
                }
            };
            t.schedule(t1, 1000);
        }
    I made application do its work for 1 second. and then make application sleep.It works fine.

    Thanks & Regards
    Sohil

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    10

    Re: Minimize J2ME application in LWUIT

    Hi Graham,

    Could you tell me how i know my application was in minimized state while application running in the background. Is there any inbuild function/API to know application is displying or not like in blackberry MAMidlet.getUiApplication().isForeground() function.

    Thanks in advance,
    Ram

  7. #7
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Minimize J2ME application in LWUIT

    please try not to double-post, you already created your own Thread...

Similar Threads

  1. application error with 3gp file in J2ME
    By ruchig_iic in forum Mobile Java Media (Graphics & Sounds)
    Replies: 10
    Last Post: 2012-01-16, 21:40
  2. Replies: 1
    Last Post: 2008-07-29, 11:07
  3. Advice For J2ME Application and Question
    By localarea in forum Mobile Java General
    Replies: 2
    Last Post: 2008-06-30, 01:36
  4. Problem in deploying j2me application
    By Basu in forum Mobile Java General
    Replies: 3
    Last Post: 2008-06-05, 12:35
  5. Replies: 0
    Last Post: 2004-08-25, 11:42

Posting Permissions

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