[Android] SidebarAdapter: get its context from the MainActivity

Adrien Maglo git at videolan.org
Fri Feb 21 18:18:08 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Feb 21 18:16:08 2014 +0100| [b8f8139cb680869d84c7aa30dba9ca4c7b05f8ab] | committer: Adrien Maglo

SidebarAdapter: get its context from the MainActivity

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b8f8139cb680869d84c7aa30dba9ca4c7b05f8ab
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java   |    2 +-
 vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 05d8a4c..2cbaefb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -195,7 +195,7 @@ public class MainActivity extends SherlockFragmentActivity {
         View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
         final ListView listView = (ListView)sidebar.findViewById(android.R.id.list);
         listView.setFooterDividersEnabled(true);
-        mSidebarAdapter = new SidebarAdapter();
+        mSidebarAdapter = new SidebarAdapter(this);
         listView.setAdapter(mSidebarAdapter);
         mMenu.setMenu(sidebar);
         mMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT, true);
diff --git a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
index 7800de0..ffa3fd1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
@@ -30,6 +30,7 @@ import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.audio.AudioBrowserFragment;
 import org.videolan.vlc.gui.video.VideoGridFragment;
 
+import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.support.v4.app.Fragment;
 import android.util.Log;
@@ -76,8 +77,8 @@ public class SidebarAdapter extends BaseAdapter {
         entries = Arrays.asList(entries2);
     }
 
-    public SidebarAdapter() {
-        mInflater = LayoutInflater.from(VLCApplication.getAppContext());
+    public SidebarAdapter(Context context) {
+        mInflater = LayoutInflater.from(context);
         mFragments = new HashMap<String, Fragment>(entries.size());
     }
 



More information about the Android mailing list