-2

I am using menu in my activity.

<item
    android:id="@+id/action_favourite"
    android:icon="@drawable/icon_favourite"
    android:showAsAction="always"/>
<item
    android:id="@+id/action_notification"
    android:actionLayout="@layout/notification_badge"
    android:showAsAction="always"/>

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar actions click
    switch (item.getItemId()) {
    case R.id.action_favourite:
        inflateFavouriteLayout();
        return true;
    case R.id.action_notification:
        inflateInboxLayout();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

I have two items in my menu.for that I have two actions favourite and notification. For favourite onOptionItemSelected method gets called but for notification action it dosen't. I used an action layout in notification menuitem. Is that the problem? why it is not calling onOptionItemSelected method for notification menu item?

Thanks in advance.

unflagged.destination
  • 1,576
  • 3
  • 19
  • 38

1 Answers1

0

I got the solution here

I need to set clicable property as false in my layout which I inflated in menu Item.

android:clickable="false"
Community
  • 1
  • 1
unflagged.destination
  • 1,576
  • 3
  • 19
  • 38