Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    /** variable sets the sleep time in ms */
    public static String PREFERENCES = "AppPreferences";
    private static SharedPreferences sharedPreferences;
    private static int DEF_INTERVAL = 60000;

    /**
     * Retrieves the number of milliseconds that the UpdateService sleeps.
     * 
     * @param context
     * @return number of milliseconds to sleep before the next update
     */
    public static int getUpdateInterval(Context context) {
        sharedPreferences = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
        int interval = sharedPreferences.getInt("UpdateInterval", DEF_INTERVAL);
        // Log.d(TAG, "New Interval: " + interval);
        return interval;
    }
}