title: Cannot create an instance of class when use onSaveInstanceState with Viewmodel
body: <p>i try to save state of CardStackView. This is ViewModel</p>
  <pre><code>class SpotViewModel(app: Application): ViewModel() {
      //for onSaveInstanceState***********************************
      var listState : Parcelable? =null
      
      
      private val spotRepository: SpotRepository = SpotRepository(app)
  
      fun insertSpot(spot: Spot) = viewModelScope.launch {
          spotRepository.insertSpot(spot)
      }
      fun updateSpot(spot:Spot) = viewModelScope.launch {
          spotRepository.updateSpot(spot)
      }
      fun deleteSpot(spot:Spot) = viewModelScope.launch {
          spotRepository.deleteSpot(spot)
      }
      fun getAllSpot() : LiveData&lt;List&lt;Spot&gt;&gt; = spotRepository.getAllSpot()
  
      class SpotViewModelFactory(private val application: Application) : ViewModelProvider.Factory{
          override fun &lt;T : ViewModel?&gt; create(modelClass: Class&lt;T&gt;): T {
              if(modelClass.isAssignableFrom(SpotViewModel::class.java)){
                  return SpotViewModel(application) as T
              }
              throw IllegalArgumentException(&quot;Unable construct viewmodel&quot;)
          }
      }
  }
  </code></pre>
  <p>this is Fragment</p>
  <pre><code>class HomeFragment : Fragment(),CardStackListener {
  
      private lateinit var drawerLayout : DrawerLayout
      private lateinit var cardStackView : CardStackView
      private lateinit var manager :CardStackLayoutManager
      private lateinit var adapter : CardStackAdapter
      private lateinit var getview : View
      private val viewModel by navGraphViewModels&lt;SpotViewModel&gt;(R.id.mobile_navigation)
      private val spotViewModel: SpotViewModel by lazy {
          ViewModelProvider(
              this,
              SpotViewModel.SpotViewModelFactory(requireActivity().application)
          )[SpotViewModel::class.java]
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
          cardStackView = view.findViewById(R.id.card_stack_view)
          drawerLayout = view.findViewById(R.id.drawer_layout)
          manager = CardStackLayoutManager(requireContext(), this)
          setupCardStackView()
          setupButton()
          if (viewModel.listState != null){
              cardStackView.layoutManager?.onRestoreInstanceState(viewModel.listState)
              viewModel.listState = null
          }
      }
  </code></pre>
  <p>when fragment destroy i saved state</p>
  <pre><code> override fun onDestroyView() {
          super.onDestroyView()
          viewModel.listState = cardStackView.layoutManager?.onSaveInstanceState()
          Log.e(&quot;State&quot;,&quot;HomeFragment Destroys&quot;)
      }
  </code></pre>
  <p>it work with regular RecyclerView but with CardStackView, it not.how can i fix it or have another way to save state of CardStackView. please help me!</p>
  <p><strong>Thanks for everything!Have a nice day, everyone!</strong></p>