Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Calendar;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;

import android.preference.PreferenceManager;

public class Main {
    @SuppressLint("DefaultLocale")
    public static void SaveLastWallpaperDate(Context context, Calendar dateTime) {
        int year = dateTime.get(Calendar.YEAR);
        int month = dateTime.get(Calendar.MONTH);
        int date = dateTime.get(Calendar.DATE);

        String dateTimeToString = String.format("%d/%d/%d", year, month, date);
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
        preferences.edit().putString("wallpaper_date", dateTimeToString).commit();
    }
}