get Localized Calendar - Android java.util

Android examples for java.util:Calendar

Description

get Localized Calendar

Demo Code


//package com.java2s;
import android.content.Context;

import java.util.Calendar;
import java.util.Locale;

public class Main {
    /**/*from ww  w  . j a  va  2  s  .  c o  m*/
     * @return the localized calendar instance
     */
    public static Calendar getLocalizedCalendar(Context context) {
        return Calendar.getInstance(getLocale(context));
    }

    /**
     * Get the current locale
     */
    public static Locale getLocale(Context context) {
        return context.getResources().getConfiguration().locale;
    }
}

Related Tutorials