Хочу добавить 2 элемента меню
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setQueryHint("Поиск");
searchView.setOnQueryTextListener(this);
return true;
MenuItem item = (MenuItem) menu.findItem(R.id.action_share);
ShareActionProvider shareAction = (ShareActionProvider) MenuItemCompat
.getActionProvider(item);
Intent shareIntent = new Intent(Intent.ACTION_SEND)
.setAction(Intent.ACTION_SEND)
.putExtra(Intent.EXTRA_TEXT, "а")
.setType("text/plain");
shareAction.setShareIntent(shareIntent);
return super.onCreateOptionsMenu(menu);
}