Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import java.util.Locale; public class Main { private static final String SELECTED_LANGUAGE = "MAHAds.Locale.Helper.Selected.Language"; public static String getLanguage(Context context) { return getPersistedData(context, Locale.getDefault().getLanguage()); } private static String getPersistedData(Context context, String defaultLanguage) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getString(SELECTED_LANGUAGE, defaultLanguage); } }