diff --git a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
index 0946cbd9f0a0d853ea58e6888902ea8517717482..46e72bf958b98b7e764b02313a566e834f5b6303 100644
--- a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
+++ b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
@@ -589,7 +589,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
             // Needs to save pending updates for recent keys when we get out of the recents
             // category because we don't want to move the recent emojis around while the user
             // is in the recents category.
-            mEmojiKeyboardAdapter.flushPendingRecentKeys();
+            mEmojiPalettesAdapter.flushPendingRecentKeys();
         }
 
         mEmojiCategory.setCurrentCategoryId(categoryId);