Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Copyright 2014 sailaway(https://github.com/sailaway)
 *
 * Licensed under theGNU GENERAL PUBLIC LICENSE Version 3 (the "License");
 *  Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 * Everyone is permitted to copy and distribute verbatim copies
 * of this license document, but changing it is not allowed.
 * 
 */

import java.util.Locale;
import android.content.Context;

public class Main {
    /**
     * @return the system language and country info like zh-CN,en-US
     * */
    public static final String getSystemLanguageAndCountry(Context context) {
        String str = Locale.getDefault().getLanguage() + "-" + Locale.getDefault().getCountry();
        return str;
    }
}