BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-16-2010, 01:57 AM   #1 (permalink)
New Member
 
Join Date: Feb 2010
Model: Storm
PIN: N/A
Carrier: AT&T
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Help In Handling Null Pointer Exception !!

Please Login to Remove!

Hi..

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
{
private AddContact()
{
super("Add Contact" , 10000, 30);
}
public void run()
{
UiApplication.getUiApplication().pushModalScreen(n ew AddContactScreen());
}
}
Offline  
Old 03-16-2010, 02:46 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Gomco 402 Suction vacuum Aspiration Machine With Hose And SmSuction tip
$225.0
Gomco 402 Suction vacuum Aspiration Machine With Hose And SmSuction tip pictureComplete Goat Bucket Milker Machine:6cfm Vacuum Pump 5L SS Jog Pulsator Shells +
$489.97
Complete Goat Bucket Milker Machine:6cfm Vacuum Pump 5L SS Jog Pulsator Shells + picture50PF 15KV 5% VACUUM FIXED CAPACITOR
$42.63
50PF 15KV 5% VACUUM FIXED CAPACITOR picturePfeiffer Vacuum PKR 251 PTR26002 Compact Cold Cathode Gauge NEW
$900.0
Pfeiffer Vacuum PKR 251 PTR26002  Compact Cold Cathode Gauge  NEW picture*New* Piab Vacuum Pump Mini 0102843 L14A6-B2N L14B2NBR
$25.01
*New* Piab Vacuum Pump Mini 0102843 L14A6-B2N L14B2NBR picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.