I am developing an Android app and in that I have a countdown timer
which onFinish()
does this -
double initial_time = 0.0;
double countup;
public void onFinish() {
startTimer();
}
public void startTimer(){
//Start the scheduled timer
Log.d("hi","crash app 0");
Early_Delay_Display.setText(R.string.Departure_Delay);
rootView.invalidate();
Timer timer = new Timer();
timer.scheduleAtFixedRate(
new java.util.TimerTask() {
@Override
public void run() {
Log.d("hi","crash app 1" + initial_time);
countup = 0.0 + initial_time;
Log.d("hi","crash app 2" + initial_time + "---------" + countup);
Early_Delay_Time.setText(String.valueOf(countup));
rootView.invalidate();
initial_time = initial_time + 0.5;
}
},
1000, 30000//delay,period
);
}
Basically using this timer, I want to display 0.5,1.0,1.5 for every 30 seconds but the app crashes.
The logs are -
crash app 0
crash app 1 0.0
crash app 2 0.0---------0.0
After this the app crashes