tabHost.setCurrentTab(0);
tabHost.addTab(tabHost.newTabSpec(TAB_LOCAL_MUSIC)
.setIndicator(TAB_LOCAL_MUSIC).
setContent(new Intent(MainActivity.this,LocalMusicActivity.class)));
tabHost.addTab(tabHost.newTabSpec(TAB_RANDOM_LISTEN)
.setIndicator(TAB_RANDOM_LISTEN)
.setContent(new Intent(MainActivity.this,RandomListenActivity.class)));
tabHost.addTab(tabHost.newTabSpec(TAB_SEARCH_SONGS)
.setIndicator(TAB_SEARCH_SONGS)
.setContent(new Intent(MainActivity.this,SearchSongsActivity.class)));

解决方案 »

  1.   

    看api说,如果是通过tabHost = (TabHost)findViewById(R.id.tabhost)得到TabHost,需要调用setup()方法,我调用后,出这个错误,07-26 12:32:18.010: ERROR/AndroidRuntime(634): Caused by: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
      

  2.   

    类似问题及解决办法:
    http://stackoverflow.com/questions/8538437/your-content-must-have-a-tabhost-whose-id-attribute-is-android-r-id-tabhost
    http://morry.iteye.com/blog/744598
      

  3.   

    看这里:
    http://blog.csdn.net/aminfo/article/details/7795450