0

how i can get title of menuitem in french string resource while the current locale is english ?

I want in special case only always get title in french ,, for ex. to send it with request...

menuItem.getTitle().toString() ---> only get string from current local

  • Look at this [closely related question here](http://stackoverflow.com/questions/17771531/android-how-to-get-string-in-specific-locale-without-changing-the-current-local) - it looks like something you can try out for your specific use case. – ishmaelMakitla Oct 31 '16 at 07:13
  • @ishmaelMakitla its not related to menuitem title ,, the deffirence i dont know title string name resource – Mahmood Abudaqa Oct 31 '16 at 07:15

2 Answers2

0

yes, you can do it as below:

Resources res = getResources(); Configuration conf = res.getConfiguration(); Locale savedLocale = conf.locale; // save your current local; conf.locale = new Local("fr"); // new french local config res.updateConfiguration(conf, null); // update your config to french. // retrieve resources from desired locale String str = res.getString(id); // restore original locale conf.locale = savedLocale; res.updateConfiguration(conf, null);

Kingfisher Phuoc
  • 8,052
  • 9
  • 46
  • 86
0

i use

android:titleCondensed

to set value !