diff options
Diffstat (limited to 'core/java/android/widget/AdapterView.java')
| -rw-r--r-- | core/java/android/widget/AdapterView.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index b94503843f97..2d10bbe4ebb7 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -886,9 +886,11 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { event.setEventType(AccessibilityEvent.TYPE_VIEW_SELECTED); } - // We first get a chance to populate the event. - onPopulateAccessibilityEvent(event); - + View selectedView = getSelectedView(); + if (selectedView != null && selectedView.getVisibility() == VISIBLE) { + // We first get a chance to populate the event. + onPopulateAccessibilityEvent(event); + } return false; } @@ -896,10 +898,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { public void onPopulateAccessibilityEvent(AccessibilityEvent event) { // We send selection events only from AdapterView to avoid // generation of such event for each child. - View selectedView = getSelectedView(); - if (selectedView != null) { - selectedView.dispatchPopulateAccessibilityEvent(event); - } + getSelectedView().dispatchPopulateAccessibilityEvent(event); } @Override |
