public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost tabHost = getTabHost(); tabHost.addTab( tabHost .newTabSpec("tab_test1") .setIndicator( getResources().getString(R.string.tab_playlist), getResources().getDrawable(R.drawable.ic_tab_playlist)) // .setContent(R.id.view1) .setContent(new Intent(this, PlaylistActivity.class))); tabHost.addTab( tabHost .newTabSpec("tab_test2") .setIndicator( getResources().getString(R.string.tab_favorites), getResources().getDrawable(R.drawable.ic_tab_sentencenote)) .setContent(new Intent(this, SentenceNoteActivity.class))); tabHost.addTab( tabHost .newTabSpec("tab_test3") .setIndicator( getResources().getString(R.string.tab_option), getResources().getDrawable(R.drawable.ic_tab_info)) .setContent(new Intent(this, OptionActivity.class))); mWaveLoopMain = (LinearLayout) findViewById(R.id.waveloop_main); mNowPlayingMain = (LinearLayout) findViewById(R.id.now_playing_main); mNowPlayingBtn = (ImageButton) findViewById(R.id.now_playing_btn); mNowPlayingArtist = (TextView) findViewById(R.id.now_playing_artist); mNowPlayingAlbum = (TextView) findViewById(R.id.now_playing_album); mNowPlayingTitle = (TextView) findViewById(R.id.now_playing_title); mNowPlayingPlayBtn = (ImageButton) findViewById(R.id.now_playing_playbtn); if (mService == null) { Intent i = new Intent(this, WaveLoopPlayerService.class); mService = startService(i); } }
private ListView createTab(String tag, int id) { final TabHost host = getTabHost(); final String label = myResource.getResource(tag).getValue(); host.addTab(host.newTabSpec(tag).setIndicator(label).setContent(id)); return (ListView) findViewById(id); }