user5620221
user5620221

Reputation:

Language reverts back to English after changing orientation

When i select a language in portrait mode, it works fine. when i change orientation to landscape and back to portrait mode by default language English gets selected.

I tried this code in android menifest file

android:configChanges="keyboard|Hidden|screenSize|orientation

So can any one suggest me how to achieve the above requirement? Thanx in advance

Upvotes: 1

Views: 1005

Answers (2)

Yogesh Rathi
Yogesh Rathi

Reputation: 6499

@Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Set your locale here...
    }

in your activity class add above code, when rotation is changed above method is called and locale not remember what you locale set on portrait locale.

Upvotes: 2

Hamed Nabizadeh
Hamed Nabizadeh

Reputation: 527

Right way is to handle it from your application Object.

public class MyApp extends Application {

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Set your locale here...
    }
}

Upvotes: -1

Related Questions