Questions tagged [android-configchanges]
185 questions
4
votes
0 answers
How to persist big RecyclerView data on orientation changes?
I'm making an app with content structure somewhat similar to Reddit. In my MainActivity.java I have a RecyclerView that could possibly have really much content. The content is loaded from the web, and I don't want to load it again everytime when the…

Iiro Krankka
- 4,959
- 5
- 38
- 42
3
votes
3 answers
How to Handle Transition of Night Mode?
We implemented night mode to our application. it works like a charm except for its transition. We are using the Base Application class to implement it. The problem is no matter what we tried we couldn't achieve a smooth transition when the…

Eren Tüfekçi
- 2,463
- 3
- 16
- 35
3
votes
2 answers
Issue with BuildConfig.FLAVOR after Android Studio 3.6 update
Anyone experiencing issues with BuildConfig.FLAVOR parameter? After Android Studio 3.6 update all of my BuildConfig usages in code were red (as if the import was removed) and I can't override it from app config, only from Crashlytics and other…

martin1337
- 2,384
- 6
- 38
- 85
3
votes
1 answer
Override onConfigurationChanged while maintaining portrait mode
How do I detect landscape mode while maintaining my layouts in portrait mode?
I have an activity which maintains the portrait mode irrespective of actual mobile orientation. I can do this by adding android:screenOrientation="portrait" to my…

jay
- 1,982
- 2
- 24
- 54
3
votes
3 answers
Night Mode state not detected in app - even when toggled ON
If night mode is ON, I want to pick a different layout in my activity.
What I have done:
added separate layout folders for night and notnight as…

Viral Patel
- 32,418
- 18
- 82
- 110
3
votes
1 answer
Keep video playing even on orientation change inside fragment?
A question like this is already posted but in my situation, there is some difference.
I have different layout design for landscape and portrait modes (both modes have VideoView) of the fragment that's why I can not use configChanges as below:…

Shadik Khan
- 1,217
- 1
- 8
- 18
3
votes
0 answers
Android MVP - How to connect the View and the Presenter layers
I'm trying to refactor my application to use the MVP pattern.
I have one open issue: I'm connecting the View (Activity in my case) to the Presenter, but once the activity is going through config changes, destroy and creation, I want to connect the…

galvan
- 7,400
- 7
- 38
- 55
3
votes
0 answers
Change Locale without refreshing and reloading the layout/fragment
How can I change the locale/language without reloading the layout?
We have to do the below to change the locale dynamically
mLocale = new Locale(LOCALE_ARABIC);
Locale.setDefault(mLocale);
Configuration config = new Configuration();
config.locale =…

vidhyashree
- 31
- 1
3
votes
1 answer
Save fragment state on orientation change when using different layouts for different orientations
I have different layouts for portrait and landscape mode. layout\activity_main.xml:
…

Misagh Emamverdi
- 3,654
- 5
- 33
- 57
3
votes
1 answer
App crashes on configuration changes
I am working on a part of my app where it runs an AsyncTask and because of this I wanted to handle configuration changes correctly.
Using the code from this link (which differs a bit from the code on the website) I was able to get the AsyncTask to…

TimCS
- 363
- 1
- 7
- 17
3
votes
2 answers
Rotation of screen crashes android app
I am new to android development. I have developed one app, now the problem is that whenever I rotate screen, app starts activity again and then its crashes application.
I found some solution on google to use android:configChanges="orientation" . It…

Jeeten Parmar
- 195
- 2
- 2
- 10
3
votes
0 answers
onSaveInstanceState() vs. onRetainCustomNonConfigurationInstance()
I am using ActionBarSherlock, along with several MenuItems that I dynamically manage, depending on program state. Specifically, I save the MenuItems into instance variables in the Activity's onCreateOptionsMenu() method, and then can show and/or…

gcl1
- 4,070
- 11
- 38
- 55
3
votes
1 answer
view.invalidate() ignored after configuration change
after one year of using SO to solve my questions, I came to a problem for which I cannot find solution.
I am using multiple threads to calculate bitmap. When new row of bitmap is calculated, I update custom view and call invalidate(). But when I…

D.D.
- 154
- 1
- 5
3
votes
4 answers
Change layout without calling onCreate
I have an activity with two layout files, one each for portrait and landscape modes. I see that the onCreate method is called each time I change orientation. I tried using
android:configChanges = "orientation"
in the manifest file, but it only…

Rameez Hussain
- 6,414
- 10
- 56
- 85
2
votes
0 answers
Android AR Sceneform device orientation change
I'm working on an app that has a Single Activity and a fullscreen Fragment in that activity that uses AR Core and inherits from Sceneform. What is a good strategy for handling orientation with AR elements? It seems that most Google produced…

kjanderson2
- 1,209
- 12
- 23