diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java index 0b04b733d3f1b..f47e26309c848 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java @@ -255,13 +255,16 @@ void show(Context context, final View anchorView, boolean isByPermanentButton, ViewGroup contentView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.app_menu_layout, null); mListView = (ListView) contentView.findViewById(R.id.app_menu_list); - mListView.setAdapter(mAdapter); int footerHeight = inflateFooter(footerResourceId, contentView, menuWidth, highlightedItemId); int headerHeight = inflateHeader(headerResourceId, headerOnClickListener, context, menuWidth); + // Set the adapter after the header is added to avoid crashes on JellyBean. + // See crbug.com/761726. + mListView.setAdapter(mAdapter); + int popupHeight = setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight, sizingPadding, footerHeight, headerHeight, anchorView); int[] popupPosition = getPopupPosition(mCurrentScreenRotation, visibleDisplayFrame,