diff options
| author | zobject <zbjection@gmail.com> | 2012-12-14 21:11:08 +0900 |
|---|---|---|
| committer | zobject <zbjection@gmail.com> | 2012-12-15 08:23:26 +0900 |
| commit | 686a805ef99b0fe53574c7110331cd91650f9999 (patch) | |
| tree | beb43d4aae4185f48cd473b1a724893ba6341b31 /core/java/android | |
| parent | bf8de6a349e19b32a1577080a9d8bb7f92b2301f (diff) | |
Fix NullpointException problem in onMenuItemSelected
If both title and condensed title is null,
item.getTitleCondensed() could be return null value
in onMenuItemSelected. therefore need to check
whether retun value is null or not.
Change-Id: Ib08f52b949a794aa7bd6cc25414041e820f62969
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Activity.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index f6b9a8e096ed..48366ab1b428 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2539,12 +2539,16 @@ public class Activity extends ContextThemeWrapper * Activity don't need to deal with feature codes. */ public boolean onMenuItemSelected(int featureId, MenuItem item) { + CharSequence titleCondensed = item.getTitleCondensed(); + switch (featureId) { case Window.FEATURE_OPTIONS_PANEL: // Put event logging here so it gets called even if subclass // doesn't call through to superclass's implmeentation of each // of these methods below - EventLog.writeEvent(50000, 0, item.getTitleCondensed().toString()); + if(titleCondensed != null) { + EventLog.writeEvent(50000, 0, titleCondensed.toString()); + } if (onOptionsItemSelected(item)) { return true; } @@ -2562,7 +2566,9 @@ public class Activity extends ContextThemeWrapper return false; case Window.FEATURE_CONTEXT_MENU: - EventLog.writeEvent(50000, 1, item.getTitleCondensed().toString()); + if(titleCondensed != null) { + EventLog.writeEvent(50000, 1, titleCondensed.toString()); + } if (onContextItemSelected(item)) { return true; } |
