Change app language programmatically in Android

前端 未结 30 2961
面向向阳花
面向向阳花 2020-11-21 04:34

Is it possible to change the language of an app programmatically while still using Android resources?

If not, is it possible to request a resource in an specific lan

30条回答
  •  走了就别回头了
    2020-11-21 05:25

    I am changed for German language for my app start itself.

    Here is my correct code. Anyone want use this same for me.. (How to change language in android programmatically)

    my code:

    Configuration config ; // variable declaration in globally
    
    // this part is given inside onCreate Method starting and before setContentView()
    
    public void onCreate(Bundle icic) 
    {
        super.onCreate(icic);
        config = new Configuration(getResources().getConfiguration());
        config.locale = Locale.GERMAN ;
        getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    
        setContentView(R.layout.newdesign);
    }
    

提交回复
热议问题