Code example for MenuItem

Methods: getItemId

0
        getActionBar().setDisplayHomeAsUpEnabled(true); 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish(); 
        } 
        return super.onOptionsItemSelected(item);
    } 
 
}