Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Locale;

import android.content.Context;

public class Main {
    private static Context sCurrentContext;

    /**
     * <pre>
     * Get {@link Locale} from device 's configuration.
     * Return {@link Locale#JAPAN} if configuration is not found.
     * </pre>
     */
    public static Locale getLocale() {
        if (sCurrentContext != null) {
            return sCurrentContext.getResources().getConfiguration().locale;
        } else {
            return Locale.JAPAN;
        }
    }
}