• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help creating tab content

Capsud

Lurker
Hi,

I've created 3 tabs and I want to add in content. Ive created an array of restaurants that I want in one of the tabs.

Unfortunatly I'm doing something wrong and my createTabContent(String tag) isn't working...
Please can someone help?

Here is my code...
Code:
 public class TabWidget extends TabActivity {
    
    ListView ls2;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        TabHost mTabHost = getTabHost();
        
        mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("A-Z").setContent(R.id.textview1));
        mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Cuisine").setContent(R.id.textview2));
        mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Location").setContent(R.id.textview3));
        
        mTabHost.setCurrentTab(0);
        createTabContent("Restaurants");
    }
    
    public View createTabContent(String tag)
    {
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, RESTAURANTS);
        ls2.setAdapter(adapter);
        return ls2;        
    }       
    }

please please help...
 
Back
Top Bottom