setCurrentTab not working

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

setCurrentTab not working

Postby theblitz » Thu Jul 19, 2012 8:54 am

For some reason setCurrentTab is not switching tabs after the first time. This is the code that I use.

Code: Select all
private OnClickListener buttonListener = new OnClickListener(){

    @Override
    public void onClick(View v) {
        tabHost.setCurrentTab(Integer.parseInt((String) v.getTag()));

    }
};


It is connected to buttons each of which have a tag that equals the number of of tab to be shown. When the button is clicked the first time and this method is called then the tab shows up. I can also see that it executes the code that creates the tab contents.

However, once a tab has been shown once and I have moved to another one, clicking back to it doesn't work. The method is definitely called and the tag is also correct. I put in commands to print to the log to confirm that. Also, it works first time round so must be okay.

Any idea?
theblitz
Junior Developer
Junior Developer
 
Posts: 22
Joined: Fri Feb 18, 2011 9:11 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests