单实例活动不接收输入事件

发布于 2024-12-05 01:24:39 字数 238 浏览 1 评论 0原文

我的应用程序中有 2 个单实例活动,一个是登录活动 (A),它也是启动屏幕,另一个是应用程序主活动 (B)。如果我在 B 上,按手机上的主页键并转到手机上的主屏幕,那么过了一会儿,如果我转到 应用领域-->然后按我的应用程序图标 -->我回到 B。但有时 B 没有反应。如果我查看日志,我会发现触摸事件将发送到 A,但会显示 B。这是安卓的一个bug吗?看起来android认为自从应用程序启动后就显示了A,但实际上显示了B。有没有人遇到类似的问题

I have 2 single instance activities in my app one is Log in Activity(A) which is also startup screen and other is kind of application home Activity(B). If I am on B and press home key on phone and go to home screen on phone then after a while if I go to
Applications --> and Press my application icon --> I come back to B. But sometimes B is non responsive. If I look at logs I see touch events are going to A but B is displayed. Is that a bug in Android. It looks like android thinks since app is launched A is displayed but actually B is displayed. Has anyone faced similar issue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

把回忆走一遍 2024-12-12 01:24:39

据我所知,当您单击主屏幕时,应用程序(活动)将进入“暂停”状态并最小化。当您再次单击时,应用程序系统将调用“onResume”并恢复应用程序的最后一个状态,即您的情况下的状态 B。(我假设屏幕 A 和 B 是两个活动)。但是,如果您想返回应用程序的主屏幕,您应该单击后退按钮而不是主屏幕。

但是,如果您使用两个视图,则很可能会出现您所描述的问题(它们实际上不是问题或错误)。捕捉触摸或运动事件时需要小心。

As far as i know when you click home screen the application (Activity) goes into a "Pause" state and minimizes. When you click again the application system will call "onResume" and resume the last state of the application which is state B in your case.(I assume screen A and B are two activities). But if you want to get back to home screen of your app you should click back button not the home screen.

But if you are using two views its very possible to have problems as you are describing ( they are really not the problems or bugs). You need to be careful when you are catching the touch or motion events.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文