注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

少华是也的笔记

编程:为生活?为兴趣?

 
 
 

日志

 
 

[转]TabSpec activity is unable to bind to a service  

2011-05-12 22:29:59|  分类: Android |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

http://blog.csdn.net/lijie_sh/archive/2010/08/11/5805379.aspx

 

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.

Comment 2 by olivier....@gmail.com, 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.
 Comment 6 by sashib, Apr 17, 2010 god 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
Comment 8 by ivantis3, Apr 25, 2010 quite helpful, thank you.
I was pulling my hair out trying to find the problem with this code!

  评论这张
 
阅读(572)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018