×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    29

    getting issue with the dispose a dialogbox in j2me?

    Hi,
    in my application i am using a customized dialog(progress indicator) .But some times i am not able to diapose
    that dialog box even am calling dialog.dispose() and setAutoDiapose(true).If any one faced this problem Please let me
    know how to solve this issue.Bcoz of this issue my app is struck.

    Thanks in advance.
    Mamatha.S

  2. #2
    Nokia Developer Expert
    Join Date
    May 2012
    Location
    Espoo
    Posts
    224

    Re: getting issue with the dispose a dialogbox in j2me?

    Hi mamatha reddy,

    could be that you are not releasing some of the resources used in creating the customized dialog(progress indicator). Its easy to say if you could share customized dialog(progress indicator) code, and also device and SDK version.

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    29

    Re: getting issue with the dispose a dialogbox in j2me?

    hi, Thanks for ur reply. i am using this snippets for showing and disposing dialog.


    public static void disposeProgressIndicator() {
    if (progressBar != null) {
    progressBar.setTimeout(0);
    progressBar.setAutoDispose(true);
    progressBar.dispose();

    }
    }

    public void showProgressIndicator(final String labelText) {
    progressBar = new Dialog();
    progressBar.setLayout(new BorderLayout());
    progressBar.setScrollableY(false);
    progressBar.getDialogStyle().setBorder(Border.createBevelRaised());
    progressBar.getDialogStyle().setBgColor(0x999999);
    progressBar.setTransitionInAnimator(CommonTransitions.createEmpty());
    progressBar.setTransitionOutAnimator(CommonTransitions.createEmpty());
    progressBar.setAutoDispose(false);
    final Label animation = new Label(res.getImage("load"));
    animation.setPreferredH(60);
    animation.setFocusable(true);
    label = new Label(labelText);
    label.setTickerEnabled(true);
    label.setFocusable(true);
    label.setFocus(true);
    label.setPreferredH(60);
    label.getStyle().setFgColor(0xc3f7e);
    label.getSelectedStyle().setFgColor(0xc3f7e);
    progressBar.addComponent(BorderLayout.CENTER, label);
    progressBar.addComponent(BorderLayout.EAST, animation);

    int progressIndicatorHeight = Display.getInstance().getDisplayHeight() - progressBar.getContentPane().getPreferredH();
    progressIndicatorHeight /= 3;

    progressBar.show(progressIndicatorHeight * 2, progressIndicatorHeight, 20, 20, false, false);
    BackProgress = new Command("Back");
    progressBar.addCommand(BackProgress);
    progressBar.addCommandListener(new ActionListener() {

    public void actionPerformed(ActionEvent ae) {
    disposeProgressIndicator();
    stopProgressIndicator = true;
    StandAlonePlayerView.startBackgroundPlayer();
    }
    });

    }

    using device is Nokia E5,C3,X2-01.
    Mamatha.S

  4. #4
    Nokia Developer Expert
    Join Date
    May 2012
    Location
    Espoo
    Posts
    224

    Re: getting issue with the dispose a dialogbox in j2me?

    Hi mamatha reddy,

    Seems you are suing LWUIT, where did you get the LWUIT binaries?
    Do you know Nokia also recently announced LWUIT for S40 here . Project is in technology review and final release comes soon, but still you can download LWUIT binaries (S40-with-themes.jar or S40-no-themes.jar) from the above site. With that LWUIT binary you can create and compile applications on Series 40 Developer Platform 2.0 and run on device (like C3 and X2-01) based on older SDK.
    I tested your code with little modification shown below on C3 and works well without any problem.
    javax.microedition.lcdui.Image lcduiImage=null;
    try {
    lcduiImage = javax.microedition.lcdui.Image.createImage("/FindMe_canvas.png");
    } catch (IOException e) {
    e.printStackTrace();
    }
    com.sun.lwuit.Image res = com.sun.lwuit.Image.createImage(lcduiImage);

    final Label animation = new Label(res);
    Concerning your problem I can think of one place, as I can’t see your image loading code and if you use FileConnection.openInputStream() to load the image then you need to close the connection after using it.

  5. #5
    Registered User
    Join Date
    May 2012
    Location
    Hyderabad,AP,India.
    Posts
    62

    Re: getting issue with the dispose a dialogbox in j2me?

    Hi mamatha reddy,

    Even i too faced same issue in my application. so, i added the following code which worked for me, as it closes all the dialogs which are alive.
    public static void closeAllDialogs() {
    Object current = Display.getInstance().getCurrent();
    while (current instanceof Dialog) {
    if (current == progressIndicator) {
    System.out.println("\n\n\t Dialog Disposed");
    }

    ((Dialog) current).dispose();
    System.out.println("\n\n\t Dialog Disposed");
    current = Display.getInstance().getCurrent();
    }
    ((Form) current).show();
    }

    Call this method whenever u want to close ur dialog.
    Have a nice day............
    Last edited by harsha921; 2012-07-01 at 15:51.

  6. #6
    Registered User
    Join Date
    Dec 2011
    Posts
    29

    Re: getting issue with the dispose a dialogbox in j2me?

    thanks alot ....
    Mamatha.S

  7. #7
    Registered User
    Join Date
    May 2012
    Location
    Hyderabad,AP,India.
    Posts
    62

    Re: getting issue with the dispose a dialogbox in j2me?

    @mamatha reddy

Similar Threads

  1. custom Data Query dialogbox having three input fields in 3rd Edition
    By sankalp. in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-04-28, 07:43
  2. How to dispose the Form object which is added to Display / Container ?
    By neeraja.nokia in forum Mobile Java General
    Replies: 5
    Last Post: 2009-01-29, 17:01
  3. CBA button or input dialogbox
    By metosrs in forum Symbian
    Replies: 5
    Last Post: 2008-02-22, 07:13
  4. listbox+dialogbox
    By s4sandy_bit in forum Symbian
    Replies: 1
    Last Post: 2007-11-21, 10:28
  5. Dialogbox problem ..help me guys
    By mchakri16 in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-25, 14:44

Posting Permissions

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