I have a problem when starting my app and another one in split screen mode, when my app's window is enlarged over 2/3 size, my main activity restarts, how to prevent it? When I change the size by less than 1/3 nothing happens .... it doesn't restart. Sorry i didn't provide the code.
1 Answer
Activity restarts are common in Android. They happen whenever there's a configuration change. That includes resizes. You can override that behavior in the manifest (at the cost of being unable to switch layouts at different sizes), but you're better off just being able to support them.
To turn them off in the manifest, use android:configChanges="screenSize"
on the appropriate activities. This will cause Activity.onConfigurationChanged to be called instead when the screen is reized.
-
I do not understand what you mean when writing about the configuration, I have the impression that it does not restart but runs one on top of the other, because some msg in verbose have duplicate.– tomtriptCommented Oct 11, 2021 at 18:44
-
I don't understand the difference, why when I shift the size by 2/3 there is no problem, and when I shift the size by 1/3 there is. How to catch such a restart, and why the activation of the activity is duplicated.– tomtriptCommented Oct 11, 2021 at 19:16