1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-23 12:16:13 -06:00

Fix ImageAdapter context ref

This commit is contained in:
Mikołaj Pich 2017-07-15 21:23:24 +02:00
parent 6e6a053adb
commit 96bf42be33

View File

@ -37,7 +37,7 @@ public class MarksFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_marks, container, false);
GridView gridview = (GridView) view.findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(mActivity));
gridview.setAdapter(new ImageAdapter(view.getContext())); // uses the view to get the context instead of getActivity()
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
@ -45,7 +45,7 @@ public class MarksFragment extends Fragment {
Toast.makeText(mActivity,"HALLO", Toast.LENGTH_SHORT).show();
}
});
return inflater.inflate(R.layout.fragment_marks, container, false);
return view;
}
}