Questions tagged [android-configchanges]
185 questions
2
votes
0 answers
createConfigurationContext is not working
I want to change my app language , this is a code I've for supporting different api versions
val config: Configuration = context.getResources().getConfiguration()
val locale = Locale(getDefaultLang())
val res: Resources =…

Navid Abutorab
- 1,667
- 7
- 31
- 58
2
votes
1 answer
How to change locale of Activity in Android App programmatically
I want to change my language in App (or set it from saved variable in SQLite database). It is working, but its behavior is really weird. If I open my app it will change Locale in onCreate but if I start new activity from MainActivity, that new…

martin1337
- 2,384
- 6
- 38
- 85
2
votes
1 answer
Keep current sharedPreferences when android locale language is changed
When I change the locale/language of my phone, my parameters (selected theme and target language for translation function) which are saved on sharedPreference turn to default values. For example, default values of preferences are "light" for the…

Cansu Yeksan
- 45
- 5
2
votes
0 answers
Unable to disable app rotation in Multi-Window (split-screen) mode, Android
First of all, here are things I've done so far: (1) I handle screen rotation, orientation changes and Multi-Window related config changes inside my application. (2) I forbid all kinds of…

Sergey Emeliyanov
- 5,158
- 6
- 29
- 52
2
votes
2 answers
"orientation|keyboardHidden" not calling onConfigurationChanged
I want to know when the keyboard is closed, so I'm using android:configChanges="orientation|keyboardHidden". I have to override the method
onConfigurationChanged, but nothing seems to happen. Am I doing something wrong?

Bakih
- 286
- 1
- 6
- 13
2
votes
2 answers
onCreate() called twice on configuration change in Fragment with ViewPager
General context:
I have a MainActivity with a MainFragment. MainFragment has a ViewPager and I use a FragmentStatePagerAdapter to display DetailFragments based on the content of a SqliteDatabase. The content of this database is visible and managable…

thegrxp
- 103
- 1
- 9
2
votes
1 answer
java.lang.IllegalStateException: getResources() has already been called
I want my app to handle manually orientation changes.
So that why I implemented onConfigurationChanged(Configuration newConfig), as below:
@Override
public void onConfigurationChanged(Configuration newConfig) {
…

Mesabloo
- 337
- 4
- 13
2
votes
2 answers
When would one justify overriding orientation handling
When would one justify adding this to manifest.xml?
android:configChanges="orientation|keyboardHidden|screenSize"
Thankyou

Luke Allison
- 3,118
- 3
- 24
- 40
2
votes
2 answers
Android language change in onConfigurationChange method
i am using the following code in my onConfigurationChange mehtod of MainActivity
Locale locale = new Locale(getDefault().getLanguage());
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale; …
user5164758
2
votes
0 answers
How to get android video capture to survive screen rotation
I have managed to get Video capture to work for a custom camera experience (i.e. using MediaRecorder, Camera, SurfaceView, etc.). But if I am recording a video and change the orientation of the device, video capture stops. Is there way to continue…

Katedral Pillon
- 14,534
- 25
- 99
- 199
2
votes
1 answer
Can't modify UI from a new ResultReceiver after screen rotation
I'm pretty desperate. That's the situation: I have an activity and a service. Communication from service to activity relies on a pretty simple ResultReceiver.
public class ServiceReceiver extends ResultReceiver {
public…

user2502368
- 467
- 1
- 4
- 16
2
votes
3 answers
What is the best way to know if the configuration changed?
I am not sure how to get this information on my apps: how to know when an activity has been restarted because of a configuration change? (any configuration change).
In my code I need to execute a method if the activity restarted "normally" but not…

Yoann Hercouet
- 17,894
- 5
- 58
- 85
2
votes
1 answer
Android: multiple-user how to change system locale/ language per single User
I'm working on the AOSP with multiple-user.
I need to change the default system language (or locale) to single user, all my attempts change the entire system language for all users.
I use the ActivityManagerNative class,…

Raz Tourgman
- 567
- 5
- 9
2
votes
3 answers
Restoring Fragment state after configuration change if Activity layout changes
My Activity has a one-pane layout in portrait and a two-pane layout in landscape, using Fragments. I'd like the system to restore all the views after an orientation change, but I don't know where to start.
Is this even possible considering the…

Barry Fruitman
- 12,316
- 13
- 72
- 135
2
votes
1 answer
Android: ListView, at the same time remembering and forgetting its getCheckedItemPosition after rotation/configuration change
I really can't make this up so I'd be thankful for any hint. I must make some mistake here (4.1.2).
I have an Activity which, in onCreate(), sets up a subclassed ArrayAdapter for ListView items which render as a Checkable ViewGroup.
The Activity…

class stacker
- 5,357
- 2
- 32
- 65