Help In Handling Null Pointer Exception !!
I am trying to push a screen on clicking a menu item. I have add the menu in the constructor and its properly instantiated. The screen to be pushed is also present in the project. But when i click on the menu. It throws a NULL POINTER EXCEPTION. When i debug the project it opens a Vertical Field Manger window and says no source found. What could be the reason ?? Please help..
The simple code for the menu item is as shown.
private final class AddContact extends MenuItem
super("Add Contact" , 10000, 30);
public void run()
UiApplication.getUiApplication().pushModalScreen(n ew AddContactScreen());
A null pointer exception simply means you're trying to reference an object that hasn't been instantiated yet. It's very easy to find if you're in debug mode (rather than run mode) in Eclipse because the debugger will stop immediately when it encounters the exception.
Odds are you declared an object as a data member of one of your classes but never instantiated it.
Please wrap your code excerpts in the "code" tag so the indentation is preserved.
|All times are GMT -5. The time now is 05:29 AM.|
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.