To reproduce:
1) Create class that extends TabActivity
2) on the tabHost add a tab which has content set to an activity which
binds to a service via IPC
The activity binds fine normally but not when used as tab content.
DDMS reports (in my case):
ActivityManager::Binding with unknown activity: android.os.BinderProxy@436dd168
Log messages in the service verifies that the onBind method is never called.
, Jun 28, 2009
Using getApplicationContext().bindService instead of just bindService on your activity solves the problem as it is using the higher level application context.
, Apr 17, 2010god bless you oliver, took me a whole day to find this thread and the getApplicationContext() solved the issue... wish they would cover this better in the docs , Apr 25, 2010quite helpful, thank you. I was pulling my hair out trying to find the problem with this code!
本文介绍了一个关于在Android的TabActivity中绑定服务时遇到的问题及解决方案。当将绑定服务的活动设置为标签内容时,服务的onBind方法不会被调用。文章提供了解决方案:使用getApplicationContext().bindService替代普通的bindService方法。
1万+

被折叠的 条评论
为什么被折叠?



