191 questions
0
votes
1
answer
64
views
How to prevent recreation of Activity when Navigation mode changes?
My Activity specifies
android:configChanges=
"keyboard|keyboardHidden|uiMode|orientation|screenLayout|screenSize|smallestScreenSize|navigation"
But still, when the user switches the ...
2
votes
0
answers
131
views
How to avoid activity recreation due to change in CONFIG_ASSETS_PATHS?
After reboot the LauncherActivity is created. Then following a config change the activity is destroyed and recreated. I could in the log that ActivityTaskManager: Config changes=80000000 is printed. ...
1
vote
1
answer
65
views
How to specify which Android Activity should be launched after a configuration change?
I have two activities - LaunchActivity and GameActivity. It's necessary for LaunchActivity to open first because it launches GameActivity with configuration parameters. This is working fine except ...
0
votes
1
answer
110
views
Which Android configuration change do I need to ignore to prevent activity destruction/creation when system language changes?
My Vulkan-based game is based on NativeActivity and needs to avoid ALL activity destroy/recreate configuration changes because of the massive amount of load time it takes to do that. I currently have ...
0
votes
1
answer
448
views
How to make my flutter app able to get serial number of my own android device (version android 11) even if additional configuration on the device?
So for my flutter app I need to get the device (real) serial number for device identification reason for my app feature. Android id didn't suffice because if the device get factory reset, it will ...
0
votes
1
answer
145
views
Trigger configuration changes manually in java Android
I have a scenario in my app where the expected behavior occurs during a device configuration change, such as an orientation change. This means that whenever the user changes the device's orientation, ...
-1
votes
1
answer
186
views
How to observe app settings change in the app?
Is there any way to observe settings change for my app? I mean the settings that user can change in the "Settings", particular for my app, like battery optimizations, background restrictions ...
0
votes
0
answers
100
views
Why does changing the system language cause my Android NativeActivity to crash?
My game is based on NativeActivity and crashes for some reason when the user changes the phone language while the game is running. Why is this happening and how can I prevent it?
My app consists of ...
1
vote
2
answers
876
views
How to handle configuration changes (Screen orientation, App display size etc) in Android programatically
Yes, there are already a lot of answers available on stack overflow on the same topic, most of them stating the following approach:
Manifest.xml:
<activity
android:name=".MainActivity&...
1
vote
0
answers
61
views
Textview fontsize SP vs android resource dir... Is there a resource dir for font size config?
In my app we are using mostly SP in order to help visually impaired people.
However, sometimes font is just too big or too small and android components don't work very well, cutting some text or ...
0
votes
0
answers
146
views
Android RecyclerView and addOnScrollListener
This is My file where I want to fetch position on screen rotation.
and my saveInstance state
But I am Facing a logical error while the screen is rotated
I am getting a position for first but ...
0
votes
0
answers
90
views
UI is not changing as expected while changing orientation in android
Here I am using different UX designs for portrait and landscape mode for a particlular activity. Created the folders layout-sw600dp and layout-sw600dp-land ,layout-sw720dp and layout-sw720dp-land for ...
0
votes
2
answers
330
views
How to use different design for landscape and portrait mode without recalling the API calls on that Activity?
I have some API calls on my activity and different UI design for portrait and landscape mode.
I have added the below code in the manifest to avoid the activity recreation on mode change. But with the ...
0
votes
0
answers
98
views
onDestroy called for Landscape activity A when Portrait activity B is opened from A
I have an Activity A for which orientation (Portrait or Landscape) is set based on some condition. I have another activity B which is Portrait. Now when Activity A is in portrait mode and If I open ...
0
votes
1
answer
1k
views
How do I not reset my fragments when configuration changes happen?
So I have this activity that creates 4 fragments for me, which are a bottom navigation bar.
when I change to dark mode or light mode, the fragments reset and take me back to the "main fragment&...
1
vote
2
answers
1k
views
How to support Spanish and French Language in android?
I want to change the application content from English to Spanish/ French as per the selection. Do we have any build-in libraries for the same. I am new to this multilanguage part, so please help me ...
2
votes
0
answers
1k
views
Enable App to modify Android system's Dark/Night Mode Setting
I'm trying to develop an app that would be able to change the System dark mode setting (device wide). It would enable us to quickly access that "dark mode" setting and easely toggle it.
As I'...
2
votes
1
answer
767
views
Android How Lifecycle-Aware Components Detect Configuration Change inside ViewModel
My Fragment:
class FirstFragment : Fragment() {
private lateinit var binding: FragmentFirstBinding
private lateinit var viewModelFactory: FirstViewModelFactory
private lateinit var ...
1
vote
1
answer
66
views
Change App Language in devices with API 22 String don't change
I want to change String when change app locale
there is Profile Fragment
@Override
public void onClick(View v) {
Intent intent = null;
switch (v.getId()) {
case R....
7
votes
0
answers
117
views
Can a configuration change occur after startActivityForResult was called?
Given the following situation (partially pseudo-code):
User presses a button in Activity A which in turn executes this code:
progressBar.setVisibility(VISIBLE) // by default is set as INVISIBLE ...
0
votes
1
answer
503
views
Android - Restore dynamically added view state on orientation change
Im currently working with custom views which will be added to a layout dynamically. I understand how view states are safed and restored.
According to the documentation, only views with an id will be ...
0
votes
1
answer
93
views
In RecyclerView, keep element expanded / selected in config changes
I'm developing an Android app.
I have a RecyclerView, and I can expand my items (several at the same time).
The problem ocurrs when the orientation changes. I have a ViewModel, so the data is loaded ...
1
vote
1
answer
214
views
How to determine device screen size category (small, normal, large,) using code?
Currently using the below code but getting the same as normal for all Categories. Even if I go to setting and set as small also. Please help me.
if ((getResources().getConfiguration()....
3
votes
3
answers
2k
views
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'...
2
votes
0
answers
365
views
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 ...
0
votes
1
answer
160
views
onConfigurationChanged is not working for API17
I would like to trigger something if the table were tilt from portrait to landscape or vice versa.
However the onConfigurationChanged is never get triggered.
I have read few question raised few year ...
3
votes
2
answers
5k
views
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 ...
2
votes
0
answers
1k
views
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(...
2
votes
1
answer
2k
views
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 ...
1
vote
0
answers
113
views
Manually updating layout view objects in ARCore Android application
I'm currently running into an issue in an ARCore Android app (this is without sceneform). I have an activity that has a fragment that holds the ARCore session object, as well as the OpenGL ES context ...
2
votes
1
answer
465
views
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, ...
1
vote
1
answer
1k
views
Gradle - Android - add version code number as versionNameSuffix to debug buildTypes
I want to add the version code as a suffix of versionNameSuffix.
Currently, I have:
debug {
versionNameSuffix ".debug"
}
How can I have something like:
debug {
...
1
vote
0
answers
369
views
Android, Changing app language not working properly on oneplus and huawei
I am changing the app loacale like this,
Language language = getPreferenceAppLanguage();
if (language == null) {
return;
}
Locale locale = createLocale(...
2
votes
1
answer
932
views
Using android:configChanges="orientation|screenSize"/> And It is Messing Up My Landscape Layout on Orientation change
When I put in
activity android:name=".MainActivity"
android:configChanges="orientation|screenSize"
and do it for each one of my activities, the layout when I flip the orientation in the emulator ...
0
votes
0
answers
123
views
UI updates across config changes: The weird point
I am an experienced Android developer and it is a shame that I am still ineffectively fighting against fundamental issues like persisting UI changes across configuration changes.
I know, this is an ...
2
votes
0
answers
520
views
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 configChanges:...
9
votes
4
answers
2k
views
Viewpager on portrait and two panes on landscape
I'm trying to achieve a layout that shows a view pager when the device is shown on portrait and show two panes when device is on landscape.
So I made two different layout files, one with only a ...
0
votes
1
answer
225
views
How to avoid restart activity in my cordova app when device is put into a car cradle (managing runtme changes)
there are a lot of questions around this, however I was not able to solve.
My app shouldnt restart when the device is put into a specific car cradle. I just want to ignore it
I tried changing ...
7
votes
2
answers
5k
views
Android Layout Direction is not updating on run-time language change
I'm working on a application which supports two different languages -
English
Arabic
The user can switch to any language at any time & based on the selection I'm changing the app language.
...
1
vote
2
answers
353
views
Android loadout/layout-land onConfigurationChanged
I have a DialogFragment in my Android app, and I need to set android:configChanges="orientation|screenSize, I want to load different layout for my DialogFragment in portrait or landscape, but now ...
9
votes
0
answers
2k
views
Is there a layout configuration qualifier for picture-in-picture (pip) mode layouts
I have implemented pip for my app.
I note that in the Picture-in-picture support documentation it is suggested that
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|...
6
votes
4
answers
1k
views
Determine if fragment restart is due to screen rotation or Viewpager swipe?
I have an Activity with ViewPager. the ViewPager have a lot of pages, Just like a book. Each fragment has RecyclerViews with a lot of content. The following is my use case
1 - When I swipe page, ...
0
votes
2
answers
180
views
Why screenSize changes when the user switches between landscape and portrait?
According to Android guide "screenSize" changes when user rotates the device, why isn't "orientation" value enough to indicate that?
Link to android guide of activity tag
0
votes
1
answer
267
views
Android XML configChanges tag has no effect
The
android:configChanges="screenSize|orientation|keyboardHidden">
tag has no effect. My activity always is destroyed when the device is rotated. I do not know why this is. I have added every ...
1
vote
1
answer
985
views
How to solve when getLayout() method in edittext becomes null, when configuration changes in android
I am trying to get a single line from a multi line Edittext in its addTextChangeListener, using the textwatcher interface.
I wanted to update another EditText with the only first line of this ...
1
vote
0
answers
506
views
“Configchanges.Locale” not working to reflect the change in language selected from device settings [duplicate]
I have added "ConfigurationChanges = ConfigChanges.Locale" in MainActivity. Upon changing language from settings, the app restarts when selected from background but language change is not reflected. ...
1
vote
0
answers
537
views
Changing input keyboard language with locale
I have an Android application in which I have given an option for the users to select the language. In my app I have given Hindi and English language when the user selects the language Hindi it shows ...
1
vote
0
answers
167
views
Is onActivityResult() method called after a config change?
Activity A starts for result activity B. The user rotate the smartphone. The user press the back button. Activity B is finished. Activity A is re-created. After the onCreate() method, is the ...
-1
votes
2
answers
1k
views
how to use savedInstanceState to save camera information when the orientation change occure [duplicate]
I am developing an Android app with camera intent to capture images. My app is not restricted to any orientation and should work on both and my app crashes when user start in portrait and then take ...
0
votes
1
answer
682
views
When do we need to override callback onConfigurationChanged()?
If we do not want to restart the activity during config changes, we can set flag android:configChanges;
If we need to restart the activity (i.e., to update resources), we should not set the flag.
In ...