Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import android.util.Log;

public class Main {
    public static boolean updateFile(String path, String filename) {
        File f = new File(path, filename);
        Log.e("x", f.getAbsolutePath());
        Log.e("x", "" + f.exists());
        long fileTime = f.lastModified();
        long curTime = System.currentTimeMillis();
        long fileAge = curTime - fileTime;

        Log.d("updateFile", "fileTime: " + fileTime);
        Log.d("updateFile", "curTime: " + curTime);
        Log.d("updateFile", "fileage: " + fileAge);

        // return true if file is older than an hour
        return fileAge > (1000 * 60 * 60);

    }
}