简体   繁体   中英

Android exiting from other screen orientation

I have MainActivity. I start new Activity from it. Then in that new activity I have layout and layout-land file. I have a close button and a handler of it which performs finish() method. If I open the app and press the close button everything is ok. If I open the app, change the orientation and press the close button, I see closing the activity (very quickily) and then it opens again. If I press close button second time, it closes the activity. How to handle this? How can I close the activity after changing the screen orientation? Thank you!

After closing orientation by finish() method in the horizontal orientation, this activity appears again in the vertical one

When you change the orientation it kills the app and restarts it. You need to just wait another split second. It will close then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM