×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Error in first screen of app

    Sometimes, in the first screen of my app, appears the following error.

    java.lang.ArrayIndexOutOfBoundsException: 5 >= 5
    at java.util.Vector.elementAt(Vector.java:427)
    at com.sun.lwuit.Container.getComponentAt(Container.java:844)
    at com.sun.lwuit.layouts.BoxLayout.getPreferredSize(BoxLayout.java:133)
    at com.sun.lwuit.Container.calcPreferredSize(Container.java:1097)
    at com.sun.lwuit.Component.preferredSize(Component.java:1431)
    at com.sun.lwuit.Component.getPreferredSize(Component.java:473)
    at com.sun.lwuit.Component.getPreferredH(Component.java:553)
    at com.sun.lwuit.layouts.BoxLayout.layoutContainer(BoxLayout.java:84)
    at com.sun.lwuit.Container.doLayout(Container.java:813)
    at com.sun.lwuit.Container.layoutContainer(Container.java:805)
    at com.sun.lwuit.Container.doLayout(Container.java:818)
    at com.sun.lwuit.Form.sizeChangedInternal(+93)
    at com.sun.lwuit.Display.handleEvent(Display.java:1654)
    at com.sun.lwuit.Display.edtLoopImpl(Display.java:886)
    at com.sun.lwuit.Display.mainEDTLoop(Display.java:831)
    at com.sun.lwuit.RunnableWrapper.run(RunnableWrapper.java:119)

    It has no effect on the rest of the app, but when this happens, it appears a Dialog with the error inside, and I don't want it to show.
    It happens in 3 apps that I've build with Nokia SDK 2.0

    How can I avoid this?

  2. #2
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: Error in first screen of app

    Have you identified the portion of your code that is triggering the exception? Can you share it?
    -CarlosDL

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Error in first screen of app

    it seems you might be getting this due to a call to removeComponent and not calling repaint() after that !!Not sure though !!

  4. #4
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Error in first screen of app

    Quote Originally Posted by cadlg View Post
    Have you identified the portion of your code that is triggering the exception? Can you share it?
    It's impossible to me to identified the portion of the code that is triggering the exception, because all of this classes are from the LWUIT jar code.

    I've this answer from Shai Almog, one of the builders of the LWUIT library

    This is a LWUIT4S40 bug, the stack is pretty clear. I can't tell you what the bug is because I'm unfamiliar with their code but venturing a guess I would say they are probably messing with things like the title component or command components and mutating the layout from their native thread.

    Since none of your code is in the stack and the stack is on the EDT you should be in the clear UNLESS you are modifying the UI from a separate thread (e.g. the start method). In Codename One this is pretty easy to detect with the builtin EDT violation detector but here you would just have to inspect all your code or get Nokia's help.


    Anyone from Nokia, can tell me how to avoid this Dialog? Where can I capture the exception?

  5. #5
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Error in first screen of app

    Did anyone know anything about this?

    It seems to be a Nokia Lwuit bug, I don't modifying any of the class that you can see on the exception

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

    Re: Error in first screen of app

    If this dialog is coming on the first screen - say your splash screen, you can put a listener on your displayable object on screen if the focus is lost (the focus could have moved to Dialog) you can call show of your home screen to paint home screen asap you get this event.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  7. #7
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Error in first screen of app

    No, it happens just after the splash screen and after I've pressed the internet permissions.

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: Error in first screen of app

    Are you changing any components on a form (adding/removing etc) outside of the lwuit EDT thread?
    if so this can trigger this exception and still be your fault since your not supposed to change any UI stuff outside the EDT thread.

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

    Re: Error in first screen of app

    Quote Originally Posted by Javier Muñoz View Post
    No, it happens just after the splash screen and after I've pressed the internet permissions.
    After you press yes to internet permissions are you trying to place any wait gauge or connecting icon on the screen from your Network Connection thread ? It might be causing this issue.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  10. #10
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Error in first screen of app

    Yes after pressing yes to internet permissions, I show a waiting form and after this, when I show the home form is when the exception appears. How can I solve it?

  11. #11
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: Error in first screen of app

    Check if you are editing/showing the waiting form from a thread which is not the EDT. You can check if the current thread is EDT or not using the following

    Display.getInstance().isEDT();

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

    Re: Error in first screen of app

    Quote Originally Posted by Javier Muñoz View Post
    Yes after pressing yes to internet permissions, I show a waiting form and after this, when I show the home form is when the exception appears. How can I solve it?
    Do not call and displayable object or show of any displayable form from your network connection thread - this thread should be just a pure non-UI thread.

    Start this thread from your main EDT thread of the app, on the next line show the wait dialog or form - (check if network thread is completed) and kill the wait form - move to Home (do not try to do this from within the network thread) It may cause UI deadlock even...crash.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  13. #13
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Error in first screen of app

    Thanks, I'll try it!

Similar Threads

  1. Splash screen example - TCoeEvent error
    By matlev in forum Symbian
    Replies: 4
    Last Post: 2007-05-31, 07:27
  2. Splash screen error
    By xersmith in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2007-01-12, 09:47
  3. Error on running multiple screen
    By thephong in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2005-05-16, 17:40
  4. Error on running multiple screen
    By thephong in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2005-05-16, 09:38
  5. Direct Screen Access (DSA) Error?
    By parisn in forum Symbian
    Replies: 1
    Last Post: 2003-12-19, 16:32

Posting Permissions

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