I am trying to create an item (Named "ADD")in the action bar. But whenever i run the code, It first displays an item which appears as three vertical dots, when i click on the vertical dots then my item appears.
I have also noticed by clicking my item named "ADD", it changes back to the three vertical dots
Can someone please tell me why is that happening? I want my item "ADD" to be displayed directly on the screen, instead of accessing it by clicking some other item.
JAVA
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
if (id == R.id.add)
{
Log.i("Action Button Tapped", "Add");
return true;
}
return super.onOptionsItemSelected(item);
}