You are configuring search action before invoking super class where moreItem is inflated. moreItem in configureSearchAction is null, therefore there is npe when you expand search bar.