get Next Alarm Date For Week - Android android.app

Android examples for android.app:AlarmManager

Description

get Next Alarm Date For Week

Demo Code

public class Main {

  private static final long DAY_MILLS = 1000 * 60 * 60 * 24;
  private static final long WEEK_MILLS = DAY_MILLS * 7;

  public static long getNextDateForWeek(long startMills) {
    long currentMills = System.currentTimeMillis();
    long nextMills = startMills;
    while (currentMills > nextMills) {
      nextMills += WEEK_MILLS;/*from   www  .j av a 2s . c o m*/
    }
    return nextMills;
  }

}

Related Tutorials