[Android] Set adapter only if needed

Geoffrey Métais git at videolan.org
Tue Nov 7 13:22:43 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov  7 12:58:53 2017 +0100| [e97ee736e1514edf2e7c6a403ab7f422bd1aafa4] | committer: Geoffrey Métais

Set adapter only if needed

> https://code.videolan.org/videolan/vlc-android/commit/e97ee736e1514edf2e7c6a403ab7f422bd1aafa4
---

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 4ec92d469..e00d99afe 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -187,7 +187,8 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     @Override
     public void onActivityCreated(@Nullable Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
-        mAdapter = new BaseBrowserAdapter(this);
+        if (mAdapter == null)
+            mAdapter = new BaseBrowserAdapter(this);
         mLayoutManager = new LinearLayoutManager(getActivity());
         mRecyclerView.setLayoutManager(mLayoutManager);
         mRecyclerView.setAdapter(mAdapter);



More information about the Android mailing list