am e0c14848: am 5dcc9bd7: Merge "Fix bug 3387855 - Menu flashes on left side of screen" into honeycomb
* commit 'e0c148484e3855bfa48b5e874ac3a1d2663784dd':
Fix bug 3387855 - Menu flashes on left side of screen
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index b93fac4..1f93eac 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -19,6 +19,7 @@
import com.android.internal.view.menu.MenuBuilder.MenuAdapter;
import android.content.Context;
+import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.MenuItem;
@@ -46,6 +47,8 @@
private boolean mOverflowOnly;
private ViewTreeObserver mTreeObserver;
+ private final Handler mHandler = new Handler();
+
public MenuPopupHelper(Context context, MenuBuilder menu) {
this(context, menu, null, false);
}
@@ -137,8 +140,14 @@
} else {
item = mMenu.getVisibleItems().get(position);
}
- mMenu.performItemAction(item, 0);
dismiss();
+
+ final MenuItem performItem = item;
+ mHandler.post(new Runnable() {
+ public void run() {
+ mMenu.performItemAction(performItem, 0);
+ }
+ });
}
public boolean onKey(View v, int keyCode, KeyEvent event) {