public static void setMidnightUpdater ( Handler h , Runnable r , String timezone ) { if ( h == null || r == null || timezone == null ) { return ; } long now = System . currentTimeMillis ( ) ; Time time = new Time ( timezone ) ; time . set ( now ) ; long runInMillis = ( 24 * 3600 - time . hour * 3600 - time . minute * 60 - time . second + 1 ) * 1000 ; h . removeCallbacks ( r ) ; h . postDelayed ( r , runInMillis ) ; }
do run the runnable