0

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, the app's configuration reloads.

Now, I would like to trigger this behavior manually in Java. How can I achieve this in a click listener?

2
  • What is "this behavior", specifically? Commented May 16, 2024 at 19:59
  • I have some custom views, which are stored in app storage, If I remove them programmatically and configuration changes, those widgets are restored. I don't have control over those views, as users can add or remove them like widgets. But I want to restore them in a certain case. Commented May 17, 2024 at 12:13

1 Answer 1

1

You can call recreate() or change the orientation programmatically using setRequestedOrientation().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.