i have array string at res->value->strings like below :
<string-array name="language">
<item>France</item>
<item>English</item>
</string-array>
and now, inside onItemSelected i want to make if select france then Toast fance and change language to france, when i select english then Toast english and change language to english.
public class SPinnerActivity extends Activity implements
AdapterView.OnItemSelectedListener{
public void onItemSelected(AdapterView<?> parent,View view,int pos,long id){
}
public void onNothingSelected(AdapterView<?> parent){
}
}
here is method for change language :
protected void setLanguage (String language){
mylocale = new Locale(language);
Resources resources = getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
Configuration conf = resources.getConfiguration();
conf.locale = mylocale;
resources.updateConfiguration(conf,dm);
}