Actually i am developing an app for blackberry.Its like a test,that consists of 10 question,& at the end of the test,result is being displayed.Nw i want to add a timer to my application,so that when the user is taking a test,timer count will b there.i hav written one code,bt it is throwing null pointer exception,kindly help
Timer t=new Timer();
TimerTask tt=new TimerTask() {
public void run() {
UiApplication.getUiApplication();
synchronized (Application.getEventLock()) {
currentTime = System.currentTimeMillis();
long diff = currentTime - startTime;
long min = diff / 60000;
long sec = (diff % 60000) / 1000;
String minStr = new Long(min).toString();
String secStr = new Long(sec).toString();
if (min < 10)
minStr = "0" + minStr;
if (sec < 10)
secStr = "0" + secStr;
TimerCount= new LabelField(12 + ":" + 14){
protected void paint(Graphics g) {
g.setColor(Color.WHITE);
super.paint(g);
}
};
TimerCount.setFont(myFont(16));
add(TimerCount);
}
}
};
t.scheduleAtFixedRate(tt, 1000, 1000);