Diogo Ribeiro
Diogo Ribeiro

Reputation: 39

Change Tab with click the button using ABS

I make this code with base in ActionBarSherlokFragment Demo. I wish that when the user click the Button inside the Tab1 he be directed to Tab2 with this implementation because this implementation contains PageView. Is possible ?

Look the code Home: http://pastebin.com/GU63pYM6

Event Button RelatorioFragment:

bt_vergrafico.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(getActivity(), "Click", Toast.LENGTH_SHORT).show();
    }
});

Upvotes: 0

Views: 125

Answers (1)

starkej2
starkej2

Reputation: 11509

Try this

@Override
public void onClick(View v) {
    mViewPager.setCurrentItem(position);
}

Upvotes: 1

Related Questions