android - Convert to time to millisecond -


i want checked if set time less calender(mobile device)time.
shows alarms set , if set time not more 1.5 hr shows "ruko ruko" message. if both conditions false go else condition.
not gave me expected results. here code:

 gregoriancalendar mcalender=new gregoriancalendar(); mcalender.set(2013, 7, 17, 13, 0);  if(mcalender.gettimeinmillis()<=cal.gettimeinmillis()){     toast.maketext(getbasecontext(), "sets ", toast.length_short).show(); } else if(mcalender.gettimeinmillis()+5400000<=cal.gettimeinmillis()){     toast.maketext(mcontext, "ruko ruko", toast.length_short).show(); } else{     toast.maketext(getbasecontext(), "time not gone ", toast.length_short).show(); } 

the problem mcalender.gettimeinmillis() checked first. example, when alarm set 5:30, @ 4:30 first part true already, else if section entirely skipped. got reverse order , :)

    if(mcalender.gettimeinmillis()+5400000<=cal.gettimeinmillis()){         //if still have more 1.5 hours go (i.e. 2 hours left etc)         toast.maketext(mcontext, "ruko ruko", toast.length_short).show();     }     else if(mcalender.gettimeinmillis()<=cal.gettimeinmillis()){         //not more 1.5 hours, still not time yet.         toast.maketext(getbasecontext(), "sets ", toast.length_short).show();     }     else{         //time up. run action.         toast.maketext(getbasecontext(), "time not gone ", toast.length_short).show();     } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -