Code example for ActionBar

Methods: setDisplayHomeAsUpEnabled, setDisplayShowTitleEnabled, setHomeButtonEnabled

0
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        ActionBar actionBar = getSupportActionBar();
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
         
        if (getIntent().hasExtra("title")) { 
            setTitle(getIntent().getStringExtra("title")); 
        } 
         
        if (savedInstanceState == null) {
            // During initial setup, plug in the details fragment. 
            Fragment fragment = createFragment();
            fragment.setArguments(getIntent().getExtras());
            getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
        } 
    }