I made a function that is called every 1 second and within that function I wrote
myButton.setText("Stop");
now everything works great without that code,but whenever I write this code,the mobile I make my test on shows message "app has stopped working" I've been looking for a solution 3 days now,help will be appreciated!
this is my code
check_time = new TimerTask() {
@Override
public void run() {
myButton.setText("Stop");
Calendar lo_Calender = Calendar.getInstance();
int current_h = lo_Calender.get(Calendar.HOUR);
int current_m = lo_Calender.get(Calendar.MINUTE);
if (H_toWake == current_h && M_toWake == current_m) {
out.println("ring");
alarm();
//return;
} else {
out.println("no ring!");
}
}
};
time.schedule(check_time, 0, 1000);
}