in android development site, i saw the explanation of onOptionsItemSelected
, on the return
side, it said that:
boolean Return false to allow normal menu processing to proceed, true to consume it here.
Sorry for my dumb, can anyone illustrate what the sentence is explaining, should i return true or false in the normal situation?
You should return true if you process the menu item and return super.onOptionsItemSelected(item) if you don't.
e.g.
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.option1:
handleOption1();
return true;
case R.id.option2:
handleOption2();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
I think you can just let the system handle it by doing :
return super(...);
Else, the return TRUE/FALSE just means that if the case you are treating has fully handled the event just return TRUE. If thats not the case then return false, and system should be dispatching the even to the right handler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With