I am using AppCompat for my theme in my app. Also, I am using a viewpager to manage some fragments. Now I would to hide the actionbar in one of my fragments. How can I do that. I tried to hide the actionbar manually in the fragment like this
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBarActivity activity = (ActionBarActivity) this.getActivity();
ActionBar aBar = activity.getSupportActionBar();
aBar.hide();
}
but this hides the actionbar for all fragments. Any ideas?
When you load other fragments call (for example in onResume):
Edit:
in each fragment that you want to have show the ActionBar put the following method:
in the OnResume method of the Fragment which you don't want the action bar to show do this:
SInce you're using the view pager I assume you're using code similar to:
http://developer.android.com/reference/android/support/v4/view/ViewPager.html
In which case in this method: