1

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
  • 2
    Certain window resize actions result in configuration changes, the same as screen rotation, locale change, and many other user actions. Commented Oct 11, 2021 at 18:37

1 Answer 1

2

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.

2
  • 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.
    – tomtript
    Commented 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.
    – tomtript
    Commented Oct 11, 2021 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.