Cannot infer type arguments for ArrayAdapter<>
Sometimes the methods do not run directly in the activity and do not have access to it, not because of this, but because of the getApplicationContext ()
ArrayAdapter adapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, mutableBookings);
Try using type in your Adapter
declaring. You are missing the type
of your mutableBookings
:
final ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mutableBookings);
You need to pass a Context to the Constructor of ArrayAdapter. You're actually in initializing it in a Fragment class, so this
is not valid as a Context. Try calling
final ArrayAdapter adapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1,
mutableBookings);