Code example for MenuItem

Methods: getItemId

0
        finish(); 
        return true; 
    } 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                if (popFragment()) { 
                    return true; 
                } 
                break; 
        } 
 
        return super.onOptionsItemSelected(item);
    } 
 
    private boolean popFragment() { 
        FragmentManager fm = getFragmentManager();
        if (fm.getBackStackEntryCount() > 0) {
            fm.popBackStack();
            return true;