I dont know where i am going wrong.
Code:
package com.rim.samples.device.LostnFound;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.system.Bitmap;
class Lost_n_Found_Entry extends MainScreen {
private static Bitmap _bitmap ;
UiApplication _UiApp;
MenuItem _MeniItem;
String _S_enable;
public Lost_n_Found_Entry() {
_bitmap = Bitmap.getBitmapResource("ob_splash.PNG");
add(new BitmapField(_bitmap, Field.FIELD_HCENTER | Field.FIELD_VCENTER));
_UiApp = UiApplication.getUiApplication();
if(Lost_n_Found_Passwd._s_Enable_Flag == 0)
_S_enable = "Enable";
else
_S_enable = "Disable";
}
MenuItem _Enable = new MenuItem(_S_enable, 200000, 10) {
public void run() {
if(_S_enable.equals("Enable") ) {
Lost_n_Found_Passwd._s_Enable_Flag = 1;
_UiApp.popScreen(_UiApp.getActiveScreen());
_UiApp.pushScreen(new Lost_n_Found_Entry());
} else {
Lost_n_Found_Passwd._s_Enable_Flag = 0;
_UiApp.popScreen(_UiApp.getActiveScreen());
_UiApp.pushScreen(new Lost_n_Found_Entry());
}
}
};
MenuItem _Settings = new MenuItem("Settings", 200000, 10) {
public void run() {
_UiApp.popScreen(_UiApp.getActiveScreen());
_UiApp.pushScreen(new Lost_n_Found_Settings());
}
};
MenuItem _About = new MenuItem("About", 200000, 10) {
public void run() {
}
};
MenuItem _Exit = new MenuItem("Exit", 200000, 10) {
public void run() {
System.exit(0);
}
};
protected void makeMenu(Menu menu, int instance) {
menu.add(_Enable);
menu.add(_Settings);
menu.addSeparator();
menu.add(_About);
menu.addSeparator();
menu.add(_Exit);
super.makeMenu(menu, instance);
}
}
When ever i click on the trackwheel to view the menu , i get a nullPointerException.