i am creating multi language app for Englsih and hindi
following code i used and its working perfectly, but some things are deprecated from it, just tell me how to solve it ,
deprecated code is
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
my whole code :(this is not full code i am just showing you main part)
 private  Intent intent;
    private Locale myLocale;
    private  Resources res;
    private DisplayMetrics dm;
    private Configuration conf;
switch(lang)
                    {
                        case "no_lang":
                            editor = preferences.edit();
                            editor.putString("set_language","en");
                            editor.commit();
                            myLocale = new Locale("en");
                            res = getResources();
                            dm = res.getDisplayMetrics();
                            conf = res.getConfiguration();
                            conf.locale = myLocale;
                            res.updateConfiguration(conf, dm);
                            intent = new Intent(SplashActivity.this, MainActivity.class);
                            startActivity(intent);
                            finish();
                            break;
                        case "en":
                            editor = preferences.edit();
                            editor.putString("set_language","en");
                            editor.commit();
                            myLocale = new Locale("en");
                            res = getResources();
                            dm = res.getDisplayMetrics();
                            conf = res.getConfiguration();
                            conf.locale = myLocale;
                            res.updateConfiguration(conf, dm);
                            intent = new Intent(SplashActivity.this, MainActivity.class);
                            startActivity(intent);
                            finish();
                            break;
                        case "hi":
                            editor = preferences.edit();
                            editor.putString("set_language","hi");
                            editor.commit();
                            myLocale = new Locale("hi");
                            res = getResources();
                            dm = res.getDisplayMetrics();
                            conf = res.getConfiguration();
                            conf.locale = myLocale;
                            res.updateConfiguration(conf, dm);
                            intent = new Intent(SplashActivity.this, MainActivity.class);
                            startActivity(intent);
                            finish();
                            break;
                    }
 
    