From 9eb88180592dfd65a0afc5d7373bb35403cf4657 Mon Sep 17 00:00:00 2001 From: "Garfield, Tan" Date: Thu, 21 Apr 2016 13:21:11 -0700 Subject: [PATCH] Disable view recycling to avoid passing wrong type of view to Item.bindView(). Bug: 28298672 Change-Id: I1f7442ea3c6287da40b3e5fde25b16c2f2a7b685 --- .../src/com/android/documentsui/RootsFragment.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java index 8bbcc306af9af..94edd832280ad 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java @@ -228,10 +228,11 @@ public class RootsFragment extends Fragment { } public View getView(View convertView, ViewGroup parent) { - if (convertView == null) { - convertView = LayoutInflater.from(parent.getContext()) + // Disable recycling views because 1) it's very unlikely a view can be recycled here; + // 2) there is no easy way for us to know with which layout id the convertView was + // inflated; and 3) simplicity is much appreciated at this time. + convertView = LayoutInflater.from(parent.getContext()) .inflate(mLayoutId, parent, false); - } bindView(convertView); return convertView; }