Commit 1c800f86 authored by Edward Wang's avatar Edward Wang

DirectoryAdapter: fix crash

To access theme resources, the Activity context must be used, not the global context.
parent 1bb655c1
......@@ -237,15 +237,15 @@ public class DirectoryAdapter extends BaseAdapter {
private String mCurrentDir;
private String mCurrentRoot;
public DirectoryAdapter() {
DirectoryAdapter_Core(null);
public DirectoryAdapter(Context context) {
DirectoryAdapter_Core(context, null);
}
private void DirectoryAdapter_Core(String rootDir) {
private void DirectoryAdapter_Core(Context activityContext, String rootDir) {
if (rootDir != null)
rootDir = Util.stripTrailingSlash(rootDir);
Log.v(TAG, "rootMRL is " + rootDir);
mInflater = LayoutInflater.from(VLCApplication.getAppContext());
mInflater = LayoutInflater.from(activityContext);
mRootNode = new DirectoryAdapter.Node(rootDir);
mCurrentDir = rootDir;
this.populateNode(mRootNode, rootDir);
......
......@@ -63,7 +63,7 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDirectoryAdapter = new DirectoryAdapter();
mDirectoryAdapter = new DirectoryAdapter(getActivity());
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment