[英]android - screen orientation vs home button onStop()
I am trying to build an app where if the user press the home button , he goes back to a home page via an intent ( so via the onStop()
button that is overridden ) but the problem happens when the orientation changes, usually it also calls the onStop method so I go back to the home page also. 我正在尝试构建一个应用程序,如果用户按下主页按钮,则他会通过意图返回到主页(因此通过被覆盖的
onStop()
按钮),但是当方向改变时会发生问题,通常也是调用onStop方法,所以我也返回首页。
I tried to read the boolean isFinishing
but anw it is never true. 我试图读取布尔值
isFinishing
但是它从来都不是真的。
How can I avoid that? 我该如何避免呢?
Found it ... just posting the answer to let the other know in android there is a method called : isChangingConfigurations()
.. 找到它了...只是发布答案以让其他人在android中知道有一种叫做
isChangingConfigurations()
。
if its true than the rotation happenned 如果真比轮换发生
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.