The mapView is treated as Nullable throughout MapMeAdapter but when attaching, only a NonNull View is accepted. Even as SupportMapFragment is inflated in a parent's onCreateView, upon configuration changes onMapReady might be called before onCreateView of the parent so if the attaching is done in onMapReady the only possible valid View to pass is the one fetched by requireView() but that View has yet not been created and an IllegalException will be thrown.
Instead if getView() that is Nullable would be allowed, things would work out.
The
mapView
is treated asNullable
throughoutMapMeAdapter
but when attaching, only aNonNull View
is accepted. Even asSupportMapFragment
is inflated in a parent'sonCreateView
, upon configuration changesonMapReady
might be called beforeonCreateView
of the parent so if the attaching is done inonMapReady
the only possible validView
to pass is the one fetched byrequireView()
but thatView
has yet not been created and anIllegalException
will be thrown.Instead if
getView()
that isNullable
would be allowed, things would work out.