Search code examples
androidnavigation-drawerlocalemultilingual

DrawerLayout locale does not change


I am making a multi language application.

On click of a button I am restating the app via this code :

public void triggerRebirth(Context context) {
        Utility.setRestart(context,true);
        homeActivity.stopMediaPlayers();
        PackageManager packageManager = context.getPackageManager();
        Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName());
        ComponentName componentName = intent.getComponent();
        Intent mainIntent = Intent.makeRestartActivityTask(componentName);
        context.startActivity(mainIntent);
        Runtime.getRuntime().exit(0);
    }

All the textviews are changing but the textviews in the drawer layout I have in the code does not change. On killing the app and starting it again, the values come perfect. Why is this issue?


Solution

  • My solution is very simple(and silly also we can say) to it.

    All you need to do is setText() via code to all textview then it will pick the correct string value from correct locale language.