Code example for ActionBar

Methods: setDisplayHomeAsUpEnabled, setHomeButtonEnabled

0
public class Api14Adapter extends Api11Adapter { 
 
  @Override 
  public void configureActionBarHomeAsUp(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  } 
 
  @Override 
  public void configureSearchWidget(Activity activity, final MenuItem menuItem) {
    super.configureSearchWidget(activity, menuItem);
    SearchView searchView = (SearchView) menuItem.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
      @Override 
      public boolean onQueryTextSubmit(String query) {
        menuItem.collapseActionView();
        return false; 
      } 
      @Override 
      public boolean onQueryTextChange(String newText) {