Example usage for android.app ActionBar setDisplayHomeAsUpEnabled

List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled

Introduction

In this page you can find the example usage for android.app ActionBar setDisplayHomeAsUpEnabled.

Prototype

public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);

Source Link

Document

Set whether home should be displayed as an "up" affordance.

Usage

From source file:com.guayaba.tapir.ui.activities.ProfileActivity.java

/**
 * {@inheritDoc}//from   www . ja v a  2  s  . c  o  m
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Temporay until I can work out a nice landscape layout
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // Get the preferences
    mPreferences = PreferenceUtils.getInstance(this);

    // Initialze the image fetcher
    mImageFetcher = ApolloUtils.getImageFetcher(this);

    // Initialize the Bundle
    mArguments = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();
    // Get the MIME type
    mType = mArguments.getString(Config.MIME_TYPE);
    // Get the profile title
    mProfileName = mArguments.getString(Config.NAME);
    // Get the artist name
    if (isArtist() || isAlbum()) {
        mArtistName = mArguments.getString(Config.ARTIST_NAME);
    }

    // Initialize the pager adapter
    mPagerAdapter = new PagerAdapter(this);

    // Initialze the carousel
    mTabCarousel = (ProfileTabCarousel) findViewById(R.id.acivity_profile_base_tab_carousel);
    mTabCarousel.reset();
    mTabCarousel.getPhoto().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            ProfileType profileType;
            if (isArtist()) {
                profileType = ProfileType.ARTIST;
            } else if (isAlbum()) {
                profileType = ProfileType.ALBUM;
            } else {
                profileType = ProfileType.OTHER;
            }
            PhotoSelectionDialog.newInstance(isArtist() ? mArtistName : mProfileName, profileType)
                    .show(getSupportFragmentManager(), "PhotoSelectionDialog");
        }
    });
    // Set up the action bar
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    /* Set up the artist profile */
    if (isArtist()) {
        // Add the carousel images
        mTabCarousel.setArtistProfileHeader(this, mArtistName);

        // Artist profile fragments
        mPagerAdapter.add(ArtistSongFragment.class, mArguments);
        mPagerAdapter.add(ArtistAlbumFragment.class, mArguments);

        // Action bar title
        mResources.setTitle(mArtistName);

    } else
    // Set up the album profile
    if (isAlbum()) {
        // Add the carousel images
        mTabCarousel.setAlbumProfileHeader(this, mProfileName, mArtistName);

        // Album profile fragments
        mPagerAdapter.add(AlbumSongFragment.class, mArguments);

        // Action bar title = album name
        mResources.setTitle(mProfileName);
        // Action bar subtitle = year released
        mResources.setSubtitle(mArguments.getString(Config.ALBUM_YEAR));
    } else
    // Set up the favorites profile
    if (isFavorites()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Favorite fragment
        mPagerAdapter.add(FavoriteFragment.class, null);

        // Action bar title = Favorites
        mResources.setTitle(mProfileName);
    } else
    // Set up the last added profile
    if (isLastAdded()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Last added fragment
        mPagerAdapter.add(LastAddedFragment.class, null);

        // Action bar title = Last added
        mResources.setTitle(mProfileName);
    } else
    // Set up the user playlist profile
    if (isPlaylist()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Playlist profile fragments
        mPagerAdapter.add(PlaylistSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    } else
    // Set up the genre profile
    if (isGenre()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Genre profile fragments
        mPagerAdapter.add(GenreSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    }

    // Initialize the ViewPager
    mViewPager = (ViewPager) findViewById(R.id.acivity_profile_base_pager);
    // Attch the adapter
    mViewPager.setAdapter(mPagerAdapter);
    // Offscreen limit
    mViewPager.setOffscreenPageLimit(mPagerAdapter.getCount() - 1);
    // Attach the page change listener
    mViewPager.setOnPageChangeListener(this);
    // Attach the carousel listener
    mTabCarousel.setListener(this);
}

From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.SafeProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.safe_profile_drawer);

    Intent i = this.getIntent();
    Bundle b = i.getExtras();/*  w  w  w  .j  a  v  a 2 s  . com*/

    safe_lid = b.getString(Safe.P_SAFE_LID);

    peer = D_Peer.getPeerByLID(safe_lid, true, false);

    if (getSupportFragmentManager().findFragmentById(R.id.safe_profile_drawer_content) == null) {
        showSafeProfile();
    }
    drawerContent = prepareDrawer(peer.getSK() != null);

    Log.d(TAG, drawerContent[0]);
    drawerLayout = (DrawerLayout) findViewById(R.id.safe_profile_drawer_layout);

    // enable action bar home button
    android.app.ActionBar actBar = getActionBar();
    actBar.setDisplayHomeAsUpEnabled(true);

    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer,
            R.string.safe_profile_drawer_open, R.string.safe_profile_drawer_close);

    ListView drawer = (ListView) findViewById(R.id.safe_profile_drawer_listview);

    drawer.setAdapter(new SafeProfileAdapter(this, drawerContent, drawerState));

    SafeProfileOnItemClickListener drawerListener = new SafeProfileOnItemClickListener();
    drawer.setOnItemClickListener(drawerListener);

    drawerLayout.setDrawerListener(drawerToggle);

}

From source file:com.boko.vimusic.ui.activities.ProfileActivity.java

/**
 * {@inheritDoc}/*from   w ww  .  j  av  a2  s . co  m*/
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Temporay until I can work out a nice landscape layout
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // Get the preferences
    mPreferences = PreferenceUtils.getInstance(this);

    // Initialze the image fetcher
    mImageFetcher = CommonUtils.getImageFetcher(this);

    // Initialize the Bundle
    mArguments = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();
    // Get the MIME type
    mType = mArguments.getString(Config.MIME_TYPE);
    // Get the profile title
    mProfileName = mArguments.getString(Config.NAME);
    // Get the artist name
    if (isArtist() || isAlbum()) {
        mArtistName = mArguments.getString(Config.ARTIST_NAME);
    }

    // Initialize the pager adapter
    mPagerAdapter = new PagerAdapter(this);

    // Initialze the carousel
    mTabCarousel = (ProfileTabCarousel) findViewById(R.id.acivity_profile_base_tab_carousel);
    mTabCarousel.reset();
    mTabCarousel.getPhoto().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            ProfileType profileType;
            if (isArtist()) {
                profileType = ProfileType.ARTIST;
            } else if (isAlbum()) {
                profileType = ProfileType.ALBUM;
            } else {
                profileType = ProfileType.OTHER;
            }
            PhotoSelectionDialog.newInstance(isArtist() ? mArtistName : mProfileName, profileType)
                    .show(getSupportFragmentManager(), "PhotoSelectionDialog");
        }
    });
    // Set up the action bar
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    /* Set up the artist profile */
    if (isArtist()) {
        // Add the carousel images
        mTabCarousel.setArtistProfileHeader(this, mArtistName);

        // Artist profile fragments
        mPagerAdapter.add(ArtistSongFragment.class, mArguments);
        mPagerAdapter.add(ArtistAlbumFragment.class, mArguments);

        // Action bar title
        mResources.setTitle(mArtistName);

    } else
    // Set up the album profile
    if (isAlbum()) {
        // Add the carousel images
        mTabCarousel.setAlbumProfileHeader(this, mProfileName, mArtistName);

        // Album profile fragments
        mPagerAdapter.add(AlbumSongFragment.class, mArguments);

        // Action bar title = album name
        mResources.setTitle(mProfileName);
        // Action bar subtitle = year released
        mResources.setSubtitle(mArguments.getString(Config.ALBUM_YEAR));
    } else
    // Set up the favorites profile
    if (isFavorites()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Favorite fragment
        mPagerAdapter.add(FavoriteFragment.class, null);

        // Action bar title = Favorites
        mResources.setTitle(mProfileName);
    } else
    // Set up the last added profile
    if (isLastAdded()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Last added fragment
        mPagerAdapter.add(LastAddedFragment.class, null);

        // Action bar title = Last added
        mResources.setTitle(mProfileName);
    } else
    // Set up the user playlist profile
    if (isPlaylist()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Playlist profile fragments
        mPagerAdapter.add(PlaylistSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    } else
    // Set up the genre profile
    if (isGenre()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Genre profile fragments
        mPagerAdapter.add(GenreSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    }

    // Initialize the ViewPager
    mViewPager = (ViewPager) findViewById(R.id.acivity_profile_base_pager);
    // Attch the adapter
    mViewPager.setAdapter(mPagerAdapter);
    // Offscreen limit
    mViewPager.setOffscreenPageLimit(mPagerAdapter.getCount() - 1);
    // Attach the page change listener
    mViewPager.setOnPageChangeListener(this);
    // Attach the carousel listener
    mTabCarousel.setListener(this);
}

From source file:com.retroteam.studio.retrostudio.EditorLandscape.java

/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 *///from   www.j a va  2  s . c  om
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar(String title) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // Show the Up button in the action bar.
        ActionBar editorbar = getActionBar();
        editorbar.setDisplayHomeAsUpEnabled(true);
        editorbar.setTitle(title);

    }
}

From source file:com.github.wakhub.monodict.activity.FlashcardActivity.java

@AfterViews
void afterViews() {
    Log.d(TAG, "state: " + state.toString());
    commonActivityTrait.initActivity(preferences);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}

From source file:com.stbam.rssnewsreader.location.LocationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_location);

    // Get handles to the UI view objects
    //mLatLng = (TextView) findViewById(R.id.lat_lng);
    mAddress = (TextView) findViewById(R.id.label_address);
    mLatLng = (TextView) findViewById(R.id.label_complete_address);
    //mActivityIndicator = (ProgressBar) findViewById(R.id.address_progress);

    // Create a new global location parameters object
    mLocationRequest = LocationRequest.create();

    // para poder ir a la actividad anterior
    // sin necesidad de presionar el boton back
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    /*/*from   w  ww .j a  v a 2s. com*/
     * Set the update interval
     */
    mLocationRequest.setInterval(LocationUtils.UPDATE_INTERVAL_IN_MILLISECONDS);

    // Use high accuracy
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

    // Set the interval ceiling to one minute
    mLocationRequest.setFastestInterval(LocationUtils.FAST_INTERVAL_CEILING_IN_MILLISECONDS);

    // Note that location updates are off until the user turns them on
    mUpdatesRequested = false;

    // Open Shared Preferences
    mPrefs = getSharedPreferences(LocationUtils.SHARED_PREFERENCES, Context.MODE_PRIVATE);

    // Get an editor
    mEditor = mPrefs.edit();

    /*
     * Create a new location client, using the enclosing class to
     * handle callbacks.
     */
    mLocationClient = new LocationClient(this, this, this);

}

From source file:com.owo.android.mtPlease.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // setting for the sidedrawer
    // set the content view
    setBehindContentView(R.layout.drawer_search);
    getSlidingMenu().setFadeEnabled(true);
    getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width);
    getSlidingMenu().setShadowDrawable(R.drawable.shadow);
    getSlidingMenu().setFadeDegree(0.90f);

    searchDrawerCloseButton = (ImageButton) findViewById(R.id.button_search_drawer_close);
    searchDrawerCloseButton.setOnClickListener(new OnClickListener() {

        @Override/* w w  w. j a  v a2s .c o m*/
        public void onClick(View v) {
            // TODO Auto-generated method stub
            getSlidingMenu().showContent();
        }

    });

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    //         
    mViewPager.setOffscreenPageLimit(3);

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    locationSelectSpinner = (Spinner) findViewById(R.id.spinner_location);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.location_array,
            R.layout.spinner_text);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    locationSelectSpinner.setAdapter(adapter);

    datePickerButton = (Button) findViewById(R.id.button_datepicker);
    datePickerButton.setText(modifiedDate);
    datePickerButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            FragmentManager dialogManager = getFragmentManager();
            CalendarDialogFragment calendarDialogFragment = new CalendarDialogFragment();
            calendarDialogFragment.setParentCaller(CalendarDialogFragment.PARENT_IS_ACTIVITY);
            calendarDialogFragment.show(dialogManager, "calendar_dialog_popped");
        }

    });
    // Activity    emailAddress(SESSION_ID)  MyPageFragment
    // .

    //    
    searchButton = (ImageButton) findViewById(R.id.imageButton_search);
    searchButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            try {
                String region = locationSelectSpinner.getSelectedItem().toString();
                if (region.equals("")) {
                    region = "1";
                } else if (region.equals("")) {
                    region = "2";
                } else {
                    region = "3";
                }

                String people = ((EditText) findViewById(R.id.editText_numberPeople)).getText().toString();

                String[] tmp = (datePickerButton.getText().toString()).split(" ");
                String date = tmp[0].substring(0, 4) + "-" + tmp[1].split("")[0] + "-"
                        + tmp[2].split("")[0];

                String query = "?region=" + region + "&people=" + people + "&date=" + date + "&flag=1";
                sendInfoToFragment(people, 2);
                sendInfoToFragment(query, 0);

                getSlidingMenu().showContent();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                Toast.makeText(getApplicationContext(), "  ", Toast.LENGTH_SHORT);
                e.printStackTrace();
            }
        }

    });

}

From source file:net.czlee.debatekeeper.FormatChooserActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_format_chooser);
    DEBATING_TIMER_URI = getString(R.string.xml_uri);

    mFilesManager = new FormatXmlFilesManager(this);
    mStylesArrayAdapter = new DebateFormatEntryArrayAdapter(this, mStylesList,
            new FormatChooserActivityBinder());

    // Set the action bar
    ActionBar bar = getActionBar();
    if (bar != null)
        bar.setDisplayHomeAsUpEnabled(true);

    // Configure the checkbox
    CheckBox checkbox = (CheckBox) findViewById(R.id.formatChooser_lookForCustomCheckbox);
    checkbox.setMovementMethod(LinkMovementMethod.getInstance());
    checkbox.setOnClickListener(new LookForCustomCheckboxOnClickListener());
    mInitialLookForCustomFormats = mFilesManager.isLookingForUserFiles();
    checkbox.setChecked(mInitialLookForCustomFormats);

    // If we need it, ask the user for read permission. If it's not already granted, treat the
    // initial setting as false.
    if (mInitialLookForCustomFormats) {
        mInitialLookForCustomFormats = requestReadPermission(); // note: this method may show an alert to the user
    }//from   www.j  a  v a  2  s. c  o  m

    // Populate the styles list
    populateStylesList();

    // Configure the ListView
    mStylesListView = (ListView) findViewById(R.id.formatChooser_stylesList);
    mStylesListView.setAdapter(mStylesArrayAdapter);
    mStylesListView.setOnItemClickListener(new StylesListViewOnItemClickListener());

    // Select and scroll to the incoming selection (if existent)
    String incomingFilename = getIntent().getStringExtra(EXTRA_XML_FILE_NAME);
    setSelectionAndScroll(incomingFilename);
}

From source file:com.example.camera360.ui.ImageDetailActivity.java

@SuppressWarnings("unchecked")
@TargetApi(11)//from   w  w  w.j av  a  2s.  com
@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    arrayList = (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra(IMAGE_URL);

    // Fetch screen height and width, to use as our max size when loading
    // images as this
    // activity runs full screen

    baseAnimate = new BaseAnimate();

    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our
    // images. As the
    // image scaling ensures the image is larger than this, we should be
    // left with a
    // resolution that is appropriate for both portrait and landscape. For
    // best image quality
    // we shouldn't divide by 2, but this will use more memory and require a
    // larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of
    // app memory

    mImageDetailLayout = (FrameLayout) findViewById(R.id.image_detail_layout);

    mImageDetailView = (LinearLayout) findViewById(R.id.image_detail);

    // The ImageFetcher takes care of loading images into our ImageView
    // children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), arrayList.size());

    mInflater = LayoutInflater.from(mImageDetailLayout.getContext());

    mPager = (ViewPager) findViewById(R.id.view_pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to
    // create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);

    currentIndex = extraCurrentItem;

    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }

    mPager.setOnPageChangeListener(new ImageOnPageChangeListener());

    initHeaderMenu();

    addFooterMenu();

    initImageDetail();

    setImageInfo();
}

From source file:se.bitcraze.crazyfliecontrol.prefs.PreferencesActivity.java

/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 *//*  w  w w .j a v  a 2  s. c  o m*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        final ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
    }
}