android use localse to change language -


i want make application multi language, used 2 folders them, first 1 default values inside res folder, second 1 values-ar inside res folder. working perfect when language english.

now, want change arabic. used code:

locale locale = new locale("ar");     locale.setdefault(locale);     android.content.res.configuration config = new android.content.res.configuration();     config.locale = locale;     getbasecontext().getresources().updateconfiguration(config,             getbasecontext().getresources().getdisplaymetrics()); 

when used code, instruction of application cut , paste changed, didn't know tell application use variables values-ar folder, not values folder.

please don't worry encoding

thanks in advance

you can current language , set if condition.

string currentlang = locale.getdefault().getdisplaylanguage();  if(currentlang == "english"){       //todo  }else if(currentlang == "yourlang"){      //todo  } 

hope find usefull. cheers


Comments