How to show a custom actionbar view from one fragment only

I have a requirement for my app that a custom action bar view be shown from one fragment only (the landing page fragment). The problem is that this action bar is appearing when the user navigates to other fragments. Is there a way to do this without disabling custom view on every fragment?



For this issue, only show actionbar for one fragment without show on all other fragments, solution could be very easy:

In your activity that hosts your fragments:

protected void onCreate(Bundle savedInstanceState) {
    ... ...

    // for API >= 11
    // for API < 11

    ... ...

Then in the fragment that you want to show actionbar:

public void  onAttach(Activity activity){
    activity.getActionBar().show(); //getSupportActionBar() for API<11


public void onHiddenChanged(boolean hidden) {
    if (hidden) {
       getActivity().getActionBar().hide(); //getSupportActionBar() for API<11
    } else {
       getActivity().getActionBar().show(); //getSupportActionBar() for API<11


Need Your Help

Could not retrieve contact Presence using aSmack library for connecting google talk service

android xmpp contacts user-presence

I'm trying to implement a chat client for Android which connects to google talk service. I have done most of it, I connect to the server, I get contacts (and show them in a ListView) and I open a new

Piping standard output of tee effects output of its files

linux bash io-redirection

I came across the answer to How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)? and was playing around with grep when I noticed a s...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.