action menu with radio button

Asked

Viewed 47 times

0

I’m having problems with this code, I want the radio Buttons to appear for choice in a popup after pressing in parameters, only that’s not happening this,

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.menu_desequilibrio, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.desequilibrio_parametros:
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}
  • This switch is weird. Your idea is to really return true and end the execution of the method? For if you observe well, whenever this method returns true, the block within the clause default will not be executed.

  • Thanks, I managed to solve, it was my lack of attention.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.