警告从 TabActivity 中的 ActivityGroup 打开新 Activity
我有一个带有多个选项卡的选项卡活动。每个选项卡都有一个与其关联的 ActivityGroup,并使用 LocalActivityManager 来处理本地活动堆栈。尽管我还没有对其进行任何广泛的调试,但这一切似乎都工作正常。
我的一些活动需要打开顶部没有选项卡活动小部件的窗口。这对我来说似乎很简单,我像任何其他活动一样称呼它:
Intent i = new Intent(this, ActivityLeaveTabs.class);
startActivity(i);
说实话,一切似乎都很好,但是每次我离开选项卡活动时,我都会收到以下警告:
无法保存哪个视图具有焦点,因为焦点视图 com.android.internal.policy.impl.PhoneWindow$DecorView@43e4a3888 没有 id
我应该提到的是,我正在从作为其一部分的活动之一发送此意图一个 Activitygroup,它本身代表选项卡活动中的选项卡之一。我怀疑问题源于从那里调用“startActivity(this,...”,但我使用 getParent() 尝试了一系列变体,但这没有帮助。
我不太清楚警告的含义或是否是实际上是一个问题。任何解决警告的帮助或者如果有人可以告诉我不要担心它(该程序似乎工作得很好),将不胜感激!
I have a tabactivity with several tabs. Each tab has an ActivityGroup associated with it, and uses a LocalActivityManager to handle local activity stacks. This all seems to be working properly although I have not done any extensive debugging on it yet.
A few of my activities need to open windows which don't have the tabactivity widget at the top. This seemed straight forward enough to me and I called it like any other Activity:
Intent i = new Intent(this, ActivityLeaveTabs.class);
startActivity(i);
Everything seems to work just fine to be honest, however every time I leave the tabactivity I am getting the following warning:
couldn't save which view has the focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@43e4a3888 has no id
I should mention that I am sending this intent out from one of the activities which is part of an Activitygroup which itself represents one of the tabs from the tabactivity. I suspect the problem is stemming from calling "startActivity(this,..." from there, but I tried a bunch of variations using getParent() which did not help.
I am not exactly clear on what the warning means or if it is actually a problem. Any help resolving the warning or if anyone can tell me not to worry about it (the program seems to be working just fine) would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来这与当新活动出现时保持注意力有关。
这稍微阐明了这个问题;
DecorView
包含 Activity 中的所有其他视图。通常没有理由让它有一个 id(尽管您可以通过编程方式设置一个)。由于背景是否具有焦点并不重要,因此我认为您可以安全地忽略此警告。一个有趣的测试是尝试通过按钮的 onClick 或其他需要让另一个视图获得焦点的东西来启动下一个活动,然后查看是否仍然收到警告。
It sounds like it has something to do with saving focus as a new activity comes to the front.
This sheds a little light on the issue; the
DecorView
contains all the other views in your activity. There is not usually a reason for it to have an id (although you might be able to set one programmatically). Since it's not a big deal whether or not the background has focus, I think you can safely ignore this warning.An interesting test would be to try to launch your next activity via a button's
onClick
or something else that would require having another view gain focus and then seeing if you still get the warning.