tabhost TabSpec执行setContent时出现空指针异常NullPointerException

来源:互联网 发布:pano2vr软件下载 编辑:程序博客网 时间:2024/06/09 15:23

tabhost.newTabSpec(currentTag[0]).setIndicator("章节").setContent(R.id.tab1Audio)执行setContent时出现空指针异常,用2.2的sdk时没有出现这个问题,用4.2.2的时候出现的,解决方法:

tabhost = (TabHost)this.findViewById(android.R.id.tabhost);
  添加 tabhost.setup();//实例化了tabWidget和tabContent   

0 0