08-31-2010 05:21 AM
I've problem in accessing menu. I will explain the step I do:
I've implanted Splash Screen ( Call S1) in my application using Observer Pattern.
S1 shows progress bar and does network call in background.
Based on result and as per business logic, I popour Splashscreen and push Application Screen 1 ( call it A1).
A1 - has custom manager and sub manager. Sub manager's layout holds EditFeild, 2 - Object Choice feild and a Button. Submanger is been added to the manager and manager is been added to A1 in constructor of A1. Also I've created menuitem M1.
I've also overridden makeMenu method in A1 and add M1 to menu.
S1 shows progress bar and in the end A1 is visible. When A1 is visible, and if I press Menu button ( button with RIM icon on emulator) or back key, application cashes out.
In debugger, I can see onMenu and keycharunhandled is been called and the last call is made ot persistance.commit and error shown there is illegalstate exception.
I am sure there is not error on persistence but somewhere in my implementation of menu or it is due to multiple screen.
Going through various documents and API documentation. I could n't find help for the case so I came to experts!!!
Please do help with your views.
I've no problem in sharing the code but i thought I wold explain first.
Also I tried out various thing like starting application with A1 straight i.e. pushing A1 instead S1 ( ofcosurse I disabled all my business logic) and there on clicking menu button I can see the menu.
So I am left really clueless about what could be wrong?
Thanks for reading out.
08-31-2010 05:29 AM
welcome to the support forums!
as a first step i would suggest that you check all your UI calls to be made on the event thread.
if you have some from your background processing you may need invokelater or similar.
what happens if you don't overwrite makeMenu and press the menu key?
08-31-2010 06:23 AM
Thread [Cinemati(181)id=295001088] (Suspended (exception NonPersistableObjectException)) Persistence.commit(Object, boolean) line: 51 PersistentObject.commit() line: 149 UiOptionsRegistry(OptionsRegistry).setInt(long, int) line: 471 UiOptionsRegistry(OptionsRegistry).getIntParam(lon
HomeScreen.main(String) line: 83
I get same or similar error and trace in case of makeMenu is overridden and not overridden.
08-31-2010 09:10 AM
NonPersistableObjectException means that you try to persist an object that does not implement the Persistable interface. i don't see how it is connected to your original problem though.
08-31-2010 09:27 AM
Exactly, I am also not able to understand the connection here. I am adding data to persistance store but that is done on event of button click. This is also done by a static method call of other class and what object I am persisting has implemented marker interface Persistable. Moreover I used same method call at other places in the application and it don't give any error.
What makes me more amusing that this error been raised on click of menu button on emulator.
My method for persisting the data should only be called on button or particular menu click event. But by just mere clicking on menu button application crashes out instead of showing the Menus!!!
I am really getting clueless here what should I do?
Thanks for your reply Simon anyway.
08-31-2010 10:33 AM
i would suggest you do some debugging.
comment out all code from your make menu method. does it run?
switch the menu items in one by one. etc
08-31-2010 11:22 AM
as per your suggestion I did commented out all the code in makeMenu method and
just put the trace System.out.println(" Inside make menu");
but its not getting printed out on console in eclipse it seems makeMenu is not called atall. As per debug info it goes to onMenu method of UserSettingScreen. I've not provided or overridden onMenu method in my code.
What could be reason for this?