I have a tabbed Activity with several tab Fragments. (like artists, playlists, albums). I want to add a buttons to my home Fragment that will navigate to the other tabs after being click. For example: i click on playlists and it takes me 3 tabs over to playlists. I have no Idea how to go about this.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.fragment_home, container, false);
playlists = (Button) rootView.findViewById(R.id.playlists);
playlists.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//getActivity().getTabHost().setCurrentTabByTag("TAB2");
//viewPager.setCurrentItem(2);
}
});
return rootView;
}

Declare an interface in HomeFragment and declare listener variable
set this listener variable in HomeFragment class.
and onButton click inform the listener
Implement this interface under MainFragment