is Update Required - Android java.util

Android examples for java.util:Date Compare

Description

is Update Required

Demo Code

import android.util.Log;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main{

    public static boolean isUpdateRequired(Date lastUpdate, long now,
            long cacheMaxTime) {
        if (lastUpdate == null) {
            return true;
        }//ww  w. j  a v  a  2  s  .  c  o  m

        return now - lastUpdate.getTime() > cacheMaxTime;
    }
    public static boolean isUpdateRequired(long lastUpdateTime, long now,
            long cacheMaxTime) {
        return now - lastUpdateTime > cacheMaxTime;
    }

}

Related Tutorials