get Week Days List - Android java.util

Android examples for java.util:Week

Description

get Week Days List

Demo Code


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

import java.text.DateFormatSymbols;
import java.util.Arrays;

import java.util.Locale;

public class Main {
    /**//from ww w.ja  v  a  2s .  c om
     * @return Get the array for week days for the current locale
     */
    public static String[] getWeekDaysList(Context context) {
        DateFormatSymbols symbols = new DateFormatSymbols(
                getLocale(context));
        return Arrays.copyOfRange(symbols.getShortWeekdays(), 1, 8);
    }

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

Related Tutorials