I am using YouTube player API for playing videos from YouTube. I have a problem when entering the full screen mode. The device local is English-US and I am changing the locale of my application to Arabic. The problem is when leaving the full screen mode the application local changed to the system locale.
Asked
Active
Viewed 1,941 times
2
-
I haven't implemented this yet but there's a [Fullscreen listener in Youtube](https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayer.OnFullscreenListener#onFullscreen(boolean)) which has a method onFullscreen. Try to write inside that method a condition that when `isFullscreen` is `False`, set the local to Arabic. There's a sample code on Fullscreen in this [SO thread](http://stackoverflow.com/questions/34329549/youtube-exit-full-screen-mode-textview-visibility-issue). – ReyAnthonyRenacia Jan 09 '17 at 09:13
2 Answers
2
i have solved just by change the local again in the onConfigurationChange function

Raafat Alhmidi
- 1,106
- 12
- 18
1
Your self answer is right way, but it has a better solution if you want to keep your app language from changing.
Add to configChanges
to your manifest:
<activity
android:name=".YourYoutubePlayerActivity"
android:configChanges="orientation|screenSize|locale" />

Soyeon Kim
- 608
- 7
- 34
-
I have tried you solution but it does not keep the app from changing the language see "android:configChanges Lists configuration changes that the activity will handle itself. When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called." https://developer.android.com/guide/topics/manifest/activity-element ... it just keep the app running if these changes happen. – Christopher H. Feb 03 '20 at 18:26
-
I have reset the old locale in onConfigurationChange(). This solution worked for me. – Christopher H. Feb 03 '20 at 18:27