Hey im trying to add countdown timers to an arraylist but it is crashing. It is crashing once I try to add one countdowntimer . Was wondering is there anything I could do to fix it?
ArrayList<CountDownTimer> timers;
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
toggleLock.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Checker = new CountDownTimer(1200000, 60000)
{
@Override
public void onTick(long millisUntilFinished) {
// TODO Auto-generated method stub
//does stuff
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
}
};
Checker.start();
timers.add(Checker);
}
}
});
}
I think you need to initialize the arraylist, so might be throwing null pointer exception.