diff options
author | Adam Powell <adamp@google.com> | 2010-05-04 14:44:45 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-05-04 14:44:45 -0700 |
commit | 151af19bf409a47424ddaa51e1ac4a0c532c4eb6 (patch) | |
tree | 3910d1d0e4e9afdc01a8a568c778d1656ac4efef /core | |
parent | e083d0a2f50906423ab548047d436c74648fc488 (diff) | |
download | frameworks_base-151af19bf409a47424ddaa51e1ac4a0c532c4eb6.zip frameworks_base-151af19bf409a47424ddaa51e1ac4a0c532c4eb6.tar.gz frameworks_base-151af19bf409a47424ddaa51e1ac4a0c532c4eb6.tar.bz2 |
Fix bug 2651076 - Catch/log ActivityNotFoundException in MenuItemImpl.invoke()
Change-Id: I841a37349fbc6af33073aaecae903eb8999cc5bd
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/view/menu/MenuItemImpl.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java index 1543b62..9b58205 100644 --- a/core/java/com/android/internal/view/menu/MenuItemImpl.java +++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java @@ -16,10 +16,12 @@ package com.android.internal.view.menu; -import com.android.internal.view.menu.MenuView.ItemView; +import java.lang.ref.WeakReference; +import android.content.ActivityNotFoundException; import android.content.Intent; import android.graphics.drawable.Drawable; +import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.SubMenu; @@ -28,12 +30,14 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ContextMenu.ContextMenuInfo; -import java.lang.ref.WeakReference; +import com.android.internal.view.menu.MenuView.ItemView; /** * @hide */ public final class MenuItemImpl implements MenuItem { + private static final String TAG = "MenuItemImpl"; + private final int mId; private final int mGroup; private final int mCategoryOrder; @@ -147,8 +151,12 @@ public final class MenuItemImpl implements MenuItem { } if (mIntent != null) { - mMenu.getContext().startActivity(mIntent); - return true; + try { + mMenu.getContext().startActivity(mIntent); + return true; + } catch (ActivityNotFoundException e) { + Log.e(TAG, "Can't find activity to handle intent; ignoring", e); + } } return false; |