From e4fac53bb0e2a5234116caf8651e8d2c5a38a4f1 Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Fri, 20 Apr 2018 13:21:33 +0200 Subject: Created proper MyObservations functionality --- .../marcinzelent/liberavem/MyObservationsFragment.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java') diff --git a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java index 1d27e99..d0ad649 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java +++ b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java @@ -20,8 +20,6 @@ import java.util.ArrayList; * A simple {@link Fragment} subclass. */ public class MyObservationsFragment extends Fragment { - Observation[] observations; - Bird[] birds; public MyObservationsFragment() { // Required empty public constructor @@ -35,14 +33,8 @@ public class MyObservationsFragment extends Fragment { return rootView; } - @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - String[] list = new String[] { - "String 1", - "String 2", - "String 3" - }; - ListView observationsListView = view.findViewById(R.id.observations_list_view); + public void populateList(final Observation[] observations, final Bird[] birds) { + final ListView observationsListView = getView().findViewById(R.id.observations_list_view); observationsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -58,8 +50,7 @@ public class MyObservationsFragment extends Fragment { startActivity(detailsIntent); } }); - - ArrayAdapter adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, list); + final ObservationsListAdapter adapter = new ObservationsListAdapter(getActivity(), observations, birds); observationsListView.setAdapter(adapter); } } -- cgit v1.2.3