Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when removing while no action availabe #67

Open
jiahaoliuliu opened this issue May 10, 2012 · 0 comments
Open

Crash when removing while no action availabe #67

jiahaoliuliu opened this issue May 10, 2012 · 0 comments

Comments

@jiahaoliuliu
Copy link

The example crashes when the user is trying to remove the action bar when no action bar is shown (All them have been removed).

To fix this, when the user is removing, the number of the actions in the action bar should be checked:

case (R.id.remove_action): {
            int actionCount = actionBar.getActionCount();
            if (actionCount > 0) {
                actionBar.removeActionAt(actionCount - 1);
                Toast.makeText(HomeActivity.this, "Removed action." , Toast.LENGTH_SHORT).show();
            }
            break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant