Example usage for java.util Locale getDefault

List of usage examples for java.util Locale getDefault

Introduction

In this page you can find the example usage for java.util Locale getDefault.

Prototype

public static Locale getDefault() 

Source Link

Document

Gets the current value of the default locale for this instance of the Java Virtual Machine.

Usage

From source file:Main.java

public static String getCountry() {
    Locale locale = Locale.getDefault();
    String countryCode = locale.getCountry();
    if (TextUtils.isEmpty(countryCode)) {
        countryCode = "";
    }//from www  .  java2 s.c  om
    return countryCode;
}

From source file:Main.java

public static String getSystemLanguage(Context context) {
    return Locale.getDefault().getLanguage();
}

From source file:Main.java

public static String getCurrencySymbol() {
    return Currency.getInstance(Locale.getDefault()).getSymbol();
}

From source file:Main.java

public static String getLocationInfo() {
    String language = Locale.getDefault().getLanguage();
    String country = Locale.getDefault().getCountry();
    return language + "-" + country;
}

From source file:Main.java

public static String getHardware() {
    return Build.MANUFACTURER.toLowerCase(Locale.getDefault()) + ' '
            + Build.MODEL.toLowerCase(Locale.getDefault());
}

From source file:Main.java

public static String getLangCode() {
    String lang_code = Locale.getDefault().toString();
    if (!TextUtils.isEmpty(lang_code)) {
        if (lang_code.startsWith("zh") && !lang_code.endsWith("CN")) {
            lang_code = "zh_TW";
        }//from  www  .j a  va2s .  com
        if (lang_code.startsWith("en")) {
            lang_code = "en_US";
        }
    } else {
        lang_code = "zh_CN";
    }
    return lang_code;
}

From source file:Main.java

public static String drawableName(String appName) {
    return appName.toLowerCase(Locale.getDefault()).replace(" ", "_");
}

From source file:Main.java

public static SimpleDateFormat getTimeFormat() {
    return new SimpleDateFormat("HH:mm", Locale.getDefault());
}

From source file:Main.java

public static long addUTCTime(long timeMillis) {

    Calendar cal = Calendar.getInstance(Locale.getDefault());
    int zoneOffset = cal.get(java.util.Calendar.ZONE_OFFSET);
    int dstOffset = cal.get(java.util.Calendar.DST_OFFSET);

    timeMillis = timeMillis + zoneOffset + dstOffset;//        if (start.after(end)) {

    return timeMillis;
}

From source file:Main.java

public static String toUpperCase(Context context, int i) {
    return context.getString(i).toUpperCase(Locale.getDefault());
}