开发者

Warning opening a new Activity from an ActivityGroup within a TabActivity

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 represent开发者_如何转开发s 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜