android - Java Thread Signalling does not return execution to loop -
i have class instantiated in tread , started. code goes this:
private class startcycle implements runnable { @override public void run() { ... while(pomodoroleft > 0) { ... synchronized(runnable){ try{ runnable.wait(); } catch(interruptedexception e){} } runtime = shortlength * one_minute; //these statements not getting runnable = new clock(); //executed runnable.run(); } } }
the clock class instance name runnable follows:
private class clock implements runnable { public void run() { ... synchronized (this) { runnable.notifyall(); } //here goes alarm. } } }
for reason execution of first thread not return path , statements after. did mess notification? or there other reason that?
if you're building alarm/timer, use android built in alarmmanager
alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); am.setrepeating(alarmmanager.rtc_wakeup, (1000 * 60), (1000 * 60), yourpendingintent);
most if build own, app consume of cpu, lead lowbat user's device
Comments
Post a Comment