Is any option to add TICK MARK on the right side of the toolbar?

Viewed 4262

By default android have an option to enable BACK ARROW on the left of the toolbar using

 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 getSupportActionBar().setDisplayShowHomeEnabled(true);

same like i need TICK MARK on the right of the toolbar, is there any method to enable TICK MARK in android by default.

2 Answers

To have a onClick listener for the tick you can implement this:

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_example, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {        
    Toast toast = Toast.makeText(getApplicationContext(), "Hello toast!", Toast.LENGTH_SHORT);
    toast.show();
    return true;
}
Related