@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } switch (id) { case android.R.id.home: onBackPressed(); return true; case R.id.action_clearChat: // Limpando as mensagens no banco de dados messageDAO.limparConversa(mNumeroChatAtivo); // Limpando a lista chatAdapter.clearItemList(); // Ativando o textview com a mensagem findViewById(R.id.empty).setVisibility(View.VISIBLE); return true; } return super.onOptionsItemSelected(item); }