tags:

views:

1010

answers:

1

Hi,

I've managed to get the tab layout example working with the three tabs, albums, songs & artists thanks to other posts on this site. I'm simply trying to add a new tab called, lyrics, following the same procedure by doing the following...

Adding new activity/class called LyricsActivity.....

public class LyricsActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

     TextView textview = new TextView(this);
     textview.setText("This is the Lyrics tab");
     setContentView(textview);

} }

And then adding the following to the AndroidManifest file....

What happens is that the new Lyrics tab comes up correctly but the text, 'This is the Lyrics tab' does not display, instead it says 'This is the Songs tab'. Any ideas?

Thanks

SD

+1  A: 

Hi SD,

I think what you probably did was forgot to assign the correct intent to the tab.

// Do the same for the other tabs
intent = new Intent().setClass(this, AlbumsActivity.class);
spec = tabHost.newTabSpec("albums").setIndicator("Albums",
                  res.getDrawable(R.drawable.ic_tab_albums))
              .setContent(intent);
mTabHost.addTab(spec);

Where AlbumsActivity would be your LyricsActivity and so on.

Guide

sgarman