diff --git a/app/src/main/java/com/bmwgroup/ramsessample/fragments/FragmentCar.kt b/app/src/main/java/com/bmwgroup/ramsessample/fragments/FragmentCar.kt index 1a40bc3..e1d1e91 100644 --- a/app/src/main/java/com/bmwgroup/ramsessample/fragments/FragmentCar.kt +++ b/app/src/main/java/com/bmwgroup/ramsessample/fragments/FragmentCar.kt @@ -32,7 +32,7 @@ class FragmentCar : Fragment(), SurfaceHolder.Callback { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { mSceneThread = VehicleSceneThread("VehicleSceneThread", requireContext()) // As the activity is not guaranteed to be created in the Fragments onCreate callback call RamsesThreads initRamsesThreadAndLoadScene here - mSceneThread.initRamsesThreadAndLoadScene(activity!!.assets, "G05.ramses", "G05.rlogic") + mSceneThread.initRamsesThreadAndLoadScene(requireActivity().assets, "G05.ramses", "G05.rlogic") // Add the addOnWindowFocusChangeListener as it is not supported by default by Fragments mView!!.viewTreeObserver.addOnWindowFocusChangeListener { hasFocus ->