[Android] History: fix a crash during item layout initialization

Adrien Maglo git at videolan.org
Mon Feb 24 16:14:04 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Feb 24 16:13:43 2014 +0100| [afaf034c50a5a9f27b6253505bee4e1bb66a9e40] | committer: Adrien Maglo

History: fix a crash during item layout initialization

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index ec07e27..a0d5fad 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -29,6 +29,7 @@ import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.WeakHandler;
 import org.videolan.vlc.gui.audio.AudioUtil;
 
+import android.content.Context;
 import android.graphics.Bitmap;
 import android.os.Message;
 import android.util.Log;
@@ -45,8 +46,8 @@ public class HistoryAdapter extends BaseAdapter {
     private LayoutInflater mInflater;
     private LibVLC mLibVLC;
 
-    public HistoryAdapter() {
-        mInflater = LayoutInflater.from(VLCApplication.getAppContext());
+    public HistoryAdapter(Context context) {
+        mInflater = LayoutInflater.from(context);
         try {
             mLibVLC = LibVLC.getInstance();
         } catch (LibVlcException e) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index 5d6eff8..f31a252 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -49,7 +49,7 @@ public class HistoryFragment extends SherlockListFragment {
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        mHistoryAdapter = new HistoryAdapter();
+        mHistoryAdapter = new HistoryAdapter(getActivity());
         Log.d(TAG, "HistoryFragment()");
     }
 



More information about the Android mailing list