В чем проблема ? package com.example.cinema_provider_app.main_Fragments

import android.os.Bundle
import android.os.Handler
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import com.example.cinema_provider_app.R
import com.example.cinema_provider_app.SlideItem
import com.example.cinema_provider_app.SliderAdapter
import java.util.Timer
import java.util.TimerTask

class HomeFragment : Fragment() {
    private lateinit var timer: Timer

    private lateinit var recyclerView: RecyclerView
    private lateinit var Slider_List: List<SlideItem>

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.fragment_home, container, false)


        return view
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        Slider_List = listOf(
            SlideItem("hello", "hi", R.drawable._54282_admin),
            SlideItem("hello", "hi", R.drawable._54282_admin),
            SlideItem("hello", "hi", R.drawable._54282_admin),
            SlideItem("hello", "hi", R.drawable._54282_admin),
            SlideItem("hello", "hi", R.drawable._54282_admin),
        )
        recyclerView = requireView().findViewById(R.id.sliderRecyclerView)
        recyclerView.setHasFixedSize(false)
        recyclerView.layoutManager =
            LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
        recyclerView.adapter = SliderAdapter(Slider_List)
        recyclerView.layoutManager as LinearLayoutManager
        recyclerView.smoothScrollToPositionWithOffset(centerPosition, 0)
        timer = Timer()
        timer.scheduleAtFixedRate(object : TimerTask() {
            override fun run() {
                recyclerView.post{
                    val lastVisiblePosition = (recyclerView.layoutManager as LinearLayoutManager).findLastVisibleItemPosition()
                    if (lastVisiblePosition == Slider_List.size - 1) {
                        recyclerView.smoothScrollToPosition(0)
                    } else {
                        recyclerView.smoothScrollToPosition(lastVisiblePosition)
                    }
                }
            }
        }, 0, 10000)


    }

    override fun onDestroyView() {
        super.onDestroyView()
        timer.cancel()

    }

    companion object {
        @JvmStatic
        fun newInstance() = HomeFragment()
    }
}