Reputation: 4118
My target is do redraw view on language change. I have successfully detach and attach current fragment, but drawer items are not translated. I DO NOT want to use Activity.recreate()
and I have already tried:
View myView = (View)findViewById(R.id.my_view);
myView.invalidate();
with no success...
Upvotes: 0
Views: 298
Reputation: 3584
My suggestion to make your UI modification by a single function. and call it from onActivityCreated or onCreateView as per your code. So now whenever you will change the language, just call that function, it will take care of updating all the view automatically.
Upvotes: 1
Reputation: 912
Update the AndroidManifest file with the following configuration:
android:configChanges="locale"
In the activity level. This will trigger the:
onConfigurationChanged(Configuration newConfig)
You can override this method in your code and refresh the view from there. For more info have a look at this link
Upvotes: 0