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

alarm manager api


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -