add getactivity

This commit is contained in:
Sem van der Hoeven
2021-01-12 14:47:09 +01:00
parent baf30b5dda
commit 5e2d49ac08
8 changed files with 42 additions and 37 deletions

View File

@@ -91,7 +91,8 @@ public class HomeFragment extends Fragment implements LocationListener {
this.imageButton = view.findViewById(R.id.location_list_button);
this.imageButton.setOnClickListener(v -> {
LocationFragment locationFragment = new LocationFragment();
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
if (getActivity() != null)
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
});
// set up the route stop button