I want to make my application a multi language application. If I press a button, the language of application will change. I added multi languages String files in my values folder, but how could I update the language og the application.
            Asked
            
        
        
            Active
            
        
            Viewed 264 times
        
    2 Answers
0
            multi-launguages string files will be used only based on configuration.So you need to update it programmatically.
Example snippet:
Locale locale = new Locale("fr");//fr is the code for french language
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
      getBaseContext().getResources().getDisplayMetrics());
after running above code,you may call onCreate again, just to update the current screen
 
    
    
        Mehul Joisar
        
- 15,348
- 6
- 48
- 57
- 
                    is there will an interrution when language will change or it will change so fast even user dosnt saw it – Sasha Dec 19 '14 at 05:45
- 
                    @Sultan it depends upon the performance and capability of device. generally, it will be fast enough. – Mehul Joisar Dec 19 '14 at 05:57
0
            
            
        See here. It talks about "changing the language setting programatically". Wish it helps.
 
    
    
        Community
        
- 1
- 1
 
    
    
        suitianshi
        
- 3,300
- 1
- 17
- 34
- 
                    just to help you in improving,you should not post `link only answers`.it is discouraged.keep a habit to add some description or code to guide others. – Mehul Joisar Dec 06 '13 at 11:08
