0

Here is my code:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
    }

It is for phone. In tablet, I don't want to show "Up button" on navigation. But how programmatically?

fatihsuat
  • 111
  • 1
  • 5
  • possible duplicate [http://stackoverflow.com/questions/5832368/tablet-or-phone-android][1] [1]: http://stackoverflow.com/questions/5832368/tablet-or-phone-android – Amine ABDALKHALKI May 23 '13 at 09:54

1 Answers1

0

OK. I found it. Adding a boolean to the resource according to size of the activity is just fine.

boolean tabletSize = getResources().getBoolean(R.bool.isTablet);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && !tabletSize) {
            getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
        }
fatihsuat
  • 111
  • 1
  • 5