K. Sopheak K. Sopheak - 1 year ago 128
Android Question

How to update ActionBar after change language in PreferenceFragment?

I want to update language in app by click on the preference in setting fragment which I use preference fragment. Successfully, I can update almost everything in app after change language except

in each activity including the setting fragment. The only solution I know is to restart app.

Again, I want to change app language include ActionBar after click change in setting. Is it possible?

I have search this question, but not solve yet. Here is my setting layout.

enter image description here

Please help. Thank

Answer Source

Finally, I found a solution:

App won't change Actionbar language after change locale. I won't refresh it. It will change when I remove app from the recent app which make the app completely close.

To solve:

  1. I use setTitle(R.id.myapplabel) when you want to refresh app or oncreate, so no need to restart app.

  2. Translate activity label on string.xml and it works.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download